netperf: add Gentoo patch to fix buffer overflow compiler warnings
PATCH 1/1 netperf: add Gentoo patch to fix buffer overflow compiler warnings
From: Heiko Zuerker <[email protected]>
--- package/netperf/netperf-2.4.5-netserver.patch | 51 +++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 package/netperf/netperf-2.4.5-netserver.patch
package/netperf/netperf-2.4.5-netserver.patch new file +51 -0
@@ -0,0 +1,51 @@ +http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/netperf/files/netperf-2.4.5-netserver.patch?view=log +# Set DEBUG_LOG_FILE location +# Fix compiler warnings (bug #337422): + netserver.c: In function ?process_requests?: + netserver.c:287: warning: array subscript is above array bounds + inlined from ?process_requests? at netserver.c:268: + /usr/include/bits/stdio2.h:65: warning: call to __builtin___snprintf_chk will always overflow destination buffer + inlined from ?process_requests? at netserver.c:284: + /usr/include/bits/stdio2.h:65: warning: call to __builtin___snprintf_chk will always overflow destination buffer + +--- a/src/netserver.c ++++ b/src/netserver.c +@@ -142,7 +142,7 @@ + + #ifndef DEBUG_LOG_FILE + #ifndef WIN32 +-#define DEBUG_LOG_FILE "/tmp/netperf.debug" ++#define DEBUG_LOG_FILE "/var/log/netperf.debug" + #else + #define DEBUG_LOG_FILE "c:\\temp\\netperf.debug" + #endif /* WIN32 */ +@@ -266,7 +266,7 @@ + (!strstr(local_machine,delims[i])) && + (!strstr(local_version,delims[i]))) { + snprintf((char *)netperf_response.content.test_specific_data, +- sizeof(netperf_response) - 7, ++ MAXSPECDATA, + "%c%s%c%s%c%s%c%s", + delims[i][0], + local_sysname, +@@ -282,15 +282,15 @@ + if (i == 4) { + /* none of the delimiters were unique, use the last one */ + snprintf((char *)netperf_response.content.test_specific_data, +- sizeof(netperf_response) - 7, ++ MAXSPECDATA, + "%c%s%c%s%c%s%c%s", +- delims[i][0], ++ delims[3][0], + "NoDelimUnique", +- delims[i][0], ++ delims[3][0], + "NoDelimUnique", +- delims[i][0], ++ delims[3][0], + "NoDelimUnique", +- delims[i][0], ++ delims[3][0], + "NoDelimUnique"); + } + send_response_n(0);
Signature · 1 line
1.7.3.2
PATCH 1/1 netperf: add Gentoo patch to fix buffer overflow compiler warnings
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"heiko" == heiko <[email protected]> writes:
heiko> From: Heiko Zuerker <[email protected]> heiko> Signed-off-by: Heiko Zuerker <[email protected]> heiko> ---
heiko> package/netperf/netperf-2.4.5-netserver.patch | 51 +++++++++++++++++++++++++
So this just fixes a build warning, and otherwise doesn't affect the resulting binaries?
heiko> ++++ b/src/netserver.c
heiko> +@@ -142,7 +142,7 @@
heiko> +
heiko> + #ifndef DEBUG_LOG_FILE
heiko> + #ifndef WIN32
heiko> +-#define DEBUG_LOG_FILE "/tmp/netperf.debug" heiko> ++#define DEBUG_LOG_FILE "/var/log/netperf.debug"
What's the reason for this change?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 netperf: add Gentoo patch to fix buffer overflow compiler warnings
Quoting Peter Korsgaard <[email protected]>:
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"heiko" == heiko <[email protected]> writes:
heiko> From: Heiko Zuerker <[email protected]> heiko> Signed-off-by: Heiko Zuerker <[email protected]> heiko> ---
heiko> package/netperf/netperf-2.4.5-netserver.patch | 51+++++++++++++++++++++++++
So this just fixes a build warning, and otherwise doesn't affect the resulting binaries?
I "borrowed" this patch from Gentoo and my C skills are very basic. But from what I understand it just ge'st rid of the warnings but doesn't change the functionality.
I do use a hardened toolchain for my compile and they won't compile the code without the modification.
Quoted 9 lines
heiko> ++++
b/src/netserver.c
heiko> +@@ -142,7 +142,7 @@
heiko> +
heiko> + #ifndefDEBUG_LOG_FILE
heiko> + #ifndef WIN32
heiko> +-#defineDEBUG_LOG_FILE"/tmp/netperf.debug" heiko> ++#defineDEBUG_LOG_FILE"/var/log/netperf.debug"What's the reason for this change?
I left this in the patch on purpose, since log files belong into /var/log and not /tmp.
Signature · 7 lines
Regards Heiko Zuerker http://www.devil-linux.org ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
PATCH 1/1 netperf: add Gentoo patch to fix buffer overflow compiler warnings
In reply to Peter KorsgaardQuoted 9 lines · On Monday, December 27, 2010 15:45:56 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"heiko" == heiko <[email protected]> writes:
heiko> From: Heiko Zuerker <[email protected]> heiko> Signed-off-by: Heiko Zuerker <[email protected]> heiko> ---
heiko> package/netperf/netperf-2.4.5-netserver.patch | 51+++++++++++++++++++++++++
So this just fixes a build warning, and otherwise doesn't affect the resulting binaries?
it fixes a possible buffer overflow and invalid memory indexing
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101227/2c65b816/attachment.pgp>
PATCH 1/1 netperf: add Gentoo patch to fix buffer overflow compiler warnings
In reply to heiko at zuerker.orgQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"heiko" == heiko <[email protected]> writes:
heiko> From: Heiko Zuerker <[email protected]> heiko> Signed-off-by: Heiko Zuerker <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard