Fix PSX unmap issue causing crash on exit
[pcsx_rearmed.git] / libpcsxcore / psxbios.c
index fdc129e..12c17ef 100644 (file)
@@ -990,7 +990,7 @@ _start:
                                        case 'g': case 'G':
                                                ptmp += sprintf(ptmp, tmp2, (double)psxMu32(sp + n * 4)); n++; break;
                                        case 'p':
-                                       case 'i':
+                                       case 'i': case 'u':
                                        case 'd': case 'D':
                                        case 'o': case 'O':
                                        case 'x': case 'X':
@@ -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]; \