From: notaz Date: Sun, 10 Mar 2013 15:06:09 +0000 (+0200) Subject: psxbios: merge from pcsxr X-Git-Tag: r19~15 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=507d7c1d3eb09cbe2b7706f3fe8b88c99df54823;p=pcsx_rearmed.git psxbios: merge from pcsxr ckain's overflow fix (patch 13685) --- diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b3435ad0..12c17ef5 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -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]; \