Fix buffer overflow when writing dh->signature
Subsystems (2)
PATCH 1/1 Fix buffer overflow when writing dh->signature
Fix following compile warning when building with gcc 4.5 and with the flags '-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -O2 -Wall'.
In function 'strcpy',
inlined from 'write_kdump_header' at makedumpfile.c:5457:8: \
/usr/include/bits/string3.h:107:3: warning: call to \
__builtin___strcpy_chk will always overflow destination bufferSolution: Don't copy the terminating zero byte.
--- makedumpfile.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
makedumpfile.c +1 -1
@@ -5454,7 +5454,7 @@ write_kdump_header(void)/* * Write common header */ -strcpy (dh->signature,KDUMP_SIGNATURE ); +strncpy (dh->signature,KDUMP_SIGNATURE ,strlen (KDUMP_SIGNATURE )); dh->header_version =3 ; dh->block_size = info->page_size; dh->sub_hdr_size =sizeof (kh) + info->size_vmcoreinfo;
Signature · 7 lines
1.6.4.2 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Hi Bernhard,
Thank you for your patch.
The patch is good for me, and it has been merged into the git tree.
http://makedumpfile.git.sourceforge.net/git/gitweb.cgi?p=makedumpfile/makedumpfile;a=summary
Thanks
Ken'ichi Ohmichi
Quoted 21 lines · Bernhard Walle
Fix following compile warning when building with gcc 4.5 and with the flags '-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -O2 -Wall'.
In function 'strcpy', inlined from 'write_kdump_header' at makedumpfile.c:5457:8: \ /usr/include/bits/string3.h:107:3: warning: call to \ __builtin___strcpy_chk will always overflow destination bufferSolution: Don't copy the terminating zero byte.
Signed-off-by Bernhard Walle <[email protected]>--- makedumpfile.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)makedumpfile.c +0
-0
makedumpfile.c write_kdump_header(void) · line 5460
Quoted 8 lines
makedumpfile.c +1
-1@@ -5454,7 +5454,7 @@ write_kdump_header(void)/* * Write common header */ -strcpy (dh->signature,KDUMP_SIGNATURE ); +strncpy (dh->signature,KDUMP_SIGNATURE ,strlen (KDUMP_SIGNATURE )); dh->header_version =3 ; dh->block_size = info->page_size; dh->sub_hdr_size =sizeof (kh) + info->size_vmcoreinfo;
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec