Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/37420 )
Change subject: Fix CID 264286 Buffer not null terminated ......................................................................
Fix CID 264286 Buffer not null terminated
Because get_em100_home() can return 1024 bytes, make sure we have one more byte for strncpy to NULL terminate.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I74ea46bbe60b650331be84588c6ad5a9a9034e91 Reviewed-on: https://review.coreboot.org/c/em100/+/37420 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M em100.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/em100.c b/em100.c index d17b707..aa16e8a 100644 --- a/em100.c +++ b/em100.c @@ -734,7 +734,7 @@
char *get_em100_file(const char *name) { - char file[FILENAME_BUFFER_SIZE]; + char file[FILENAME_BUFFER_SIZE + 1]; strncpy(file, get_em100_home(), FILENAME_BUFFER_SIZE); strncat(file, name, FILENAME_BUFFER_SIZE - strlen(file) - 1); return strdup(file);