File iptraf-3.0.0-fix-promisc-crash.patch of Package iptraf
# This patch fixes bnc#548485 (https://bugzilla.novell.com/show_bug.cgi?id=548485)
#
# First hunk fixes situation where source and destination strings overlap in strcpy
#
# Second hunk extends buffer to store interface name, so that it is consistent with
# with the ifreq structure. Shorter buffer caused iptraf to crash when there was
# interface with name longer than 7 characters, like vboxnet0
---
src/ifaces.c | 6 ++----
src/promisc.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
Index: iptraf-3.0.0/src/ifaces.c
===================================================================
--- iptraf-3.0.0.orig/src/ifaces.c 2009-11-11 15:07:22.000000000 +0100
+++ iptraf-3.0.0/src/ifaces.c 2009-11-11 15:07:29.000000000 +0100
@@ -45,12 +45,10 @@ char ifaces[][6] =
char *ltrim(char *buf)
{
- char *tmp = buf;
- while ((*tmp == ' ') || (*tmp == '\t'))
- tmp++;
+ while ((*buf == ' ') || (*buf == '\t'))
+ buf++;
- strcpy(buf, tmp);
return buf;
}
Index: iptraf-3.0.0/src/promisc.c
===================================================================
--- iptraf-3.0.0.orig/src/promisc.c 2009-11-11 15:07:22.000000000 +0100
+++ iptraf-3.0.0/src/promisc.c 2009-11-11 15:07:51.000000000 +0100
@@ -49,7 +49,7 @@ void init_promisc_list(struct promisc_st
{
FILE *fd;
int ifd;
- char buf[8];
+ char buf[IF_NAMESIZE];
struct promisc_states *ptmp;
struct promisc_states *tail = NULL;
struct ifreq ifr;