Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings
@ 2010-12-26 17:31 heiko at zuerker.org
  2010-12-27 20:45 ` Peter Korsgaard
  2010-12-27 22:53 ` Peter Korsgaard
  0 siblings, 2 replies; 5+ messages in thread
From: heiko at zuerker.org @ 2010-12-26 17:31 UTC (permalink / raw)
  To: buildroot

From: Heiko Zuerker <smiley73@users.sourceforge.net>


Signed-off-by: Heiko Zuerker <smiley73@users.sourceforge.net>
---
 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

diff --git a/package/netperf/netperf-2.4.5-netserver.patch b/package/netperf/netperf-2.4.5-netserver.patch
new file mode 100644
index 0000000..d841c1c
--- /dev/null
+++ b/package/netperf/netperf-2.4.5-netserver.patch
@@ -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);
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings
  2010-12-26 17:31 [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings heiko at zuerker.org
@ 2010-12-27 20:45 ` Peter Korsgaard
  2010-12-27 20:53   ` Heiko Zuerker
  2010-12-27 21:01   ` Mike Frysinger
  2010-12-27 22:53 ` Peter Korsgaard
  1 sibling, 2 replies; 5+ messages in thread
From: Peter Korsgaard @ 2010-12-27 20:45 UTC (permalink / raw)
  To: buildroot

>>>>> "heiko" == heiko  <heiko@zuerker.org> writes:

 heiko> From: Heiko Zuerker <smiley73@users.sourceforge.net>
 heiko> Signed-off-by: Heiko Zuerker <smiley73@users.sourceforge.net>
 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?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings
  2010-12-27 20:45 ` Peter Korsgaard
@ 2010-12-27 20:53   ` Heiko Zuerker
  2010-12-27 21:01   ` Mike Frysinger
  1 sibling, 0 replies; 5+ messages in thread
From: Heiko Zuerker @ 2010-12-27 20:53 UTC (permalink / raw)
  To: buildroot

Quoting Peter Korsgaard <jacmet@uclibc.org>:

>>>>>> "heiko" == heiko  <heiko@zuerker.org> writes:
>
>  heiko> From: Heiko Zuerker <smiley73@users.sourceforge.net>
>  heiko> Signed-off-by: Heiko Zuerker <smiley73@users.sourceforge.net>
>  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.

>  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?

I left this in the patch on purpose, since log files belong into  
/var/log and not /tmp.


-- 

Regards
   Heiko Zuerker
   http://www.devil-linux.org


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings
  2010-12-27 20:45 ` Peter Korsgaard
  2010-12-27 20:53   ` Heiko Zuerker
@ 2010-12-27 21:01   ` Mike Frysinger
  1 sibling, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2010-12-27 21:01 UTC (permalink / raw)
  To: buildroot

On Monday, December 27, 2010 15:45:56 Peter Korsgaard wrote:
> >>>>> "heiko" == heiko  <heiko@zuerker.org> writes:
>  heiko> From: Heiko Zuerker <smiley73@users.sourceforge.net>
>  heiko> Signed-off-by: Heiko Zuerker <smiley73@users.sourceforge.net>
>  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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings
  2010-12-26 17:31 [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings heiko at zuerker.org
  2010-12-27 20:45 ` Peter Korsgaard
@ 2010-12-27 22:53 ` Peter Korsgaard
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2010-12-27 22:53 UTC (permalink / raw)
  To: buildroot

>>>>> "heiko" == heiko  <heiko@zuerker.org> writes:

 heiko> From: Heiko Zuerker <smiley73@users.sourceforge.net>
 heiko> Signed-off-by: Heiko Zuerker <smiley73@users.sourceforge.net>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-27 22:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-26 17:31 [Buildroot] [PATCH] netperf: add Gentoo patch to fix buffer overflow compiler warnings heiko at zuerker.org
2010-12-27 20:45 ` Peter Korsgaard
2010-12-27 20:53   ` Heiko Zuerker
2010-12-27 21:01   ` Mike Frysinger
2010-12-27 22:53 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox