From 507d7c1d3eb09cbe2b7706f3fe8b88c99df54823 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Mar 2013 17:06:09 +0200 Subject: psxbios: merge from pcsxr ckain's overflow fix (patch 13685) --- libpcsxcore/psxbios.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b3435ad..12c17ef 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]; \ -- cgit v1.2.3