psxbios: merge from pcsxr
authornotaz <notasas@gmail.com>
Sun, 10 Mar 2013 15:06:09 +0000 (17:06 +0200)
committernotaz <notasas@gmail.com>
Fri, 15 Mar 2013 00:19:08 +0000 (02:19 +0200)
ckain's overflow fix (patch 13685)

libpcsxcore/psxbios.c

index b3435ad..12c17ef 100644 (file)
@@ -1837,7 +1837,8 @@ int nfile;
                if ((*ptr & 0xF0) != 0x50) continue; \
                ptr+= 0xa; \
                if (pfile[0] == 0) { \
-                       strcpy(dir->name, ptr); \
+                       strncpy(dir->name, ptr, sizeof(dir->name)); \
+                       dir->name[sizeof(dir->name) - 1] = '\0'; \
                } else for (i=0; i<20; i++) { \
                        if (pfile[i] == ptr[i]) { \
                                dir->name[i] = ptr[i]; \