From a37c3bc6644a5f5befac7787f559b16370452861 Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Wed, 15 Aug 2018 13:29:46 -0700 Subject: [PATCH] Fix null terminator buffer overflow While updating my devkitARM I found this buffer overflow: src/input/bworld.c:56:3: warning: '__builtin_memcpy' forming offset 21 is out of the bounds [0, 20] of object 'bdata' with type 'uint8[20]' {aka 'unsigned char[20]'} [-Warray-bounds] strcpy((char*)&bdata[13], "SUNSOFT"); --- src/input/bworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/bworld.c b/src/input/bworld.c index 95339be..cf22a8c 100644 --- a/src/input/bworld.c +++ b/src/input/bworld.c @@ -53,7 +53,7 @@ static void FP_FASTAPASS(2) Update(void *data, int arg) { seq = ptr = 0; have = 1; strcpy((char*)bdata, (const char*)((uint8*)data + 1)); - strcpy((char*)&bdata[13], "SUNSOFT"); + memcpy((char*)&bdata[13], "SUNSOFT", 7); } }