Stefan Reinauer has uploaded this change for review. ( 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 --- M em100.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/20/37420/1
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);
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37420 )
Change subject: Fix CID 264286 Buffer not null terminated ......................................................................
Patch Set 1: Code-Review+2
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);