Hi,
This series contains patches SUSE had accumulated for iptraf-3.x, now rebased to iptraf-ng. Patches are independent, so please pick what you think is suitable for you.
Thanks.
Petr Uzel (6): main(): allow regular users to run iptraf if the sticky-bit is set init_promisc_list(): use IF_NAMESIZE as size of buffer for interface name selectiface(): use strncpy to prevent buffer overflow and thus avoid gcc warning build: pass libpanel_CFLAGS and ncurses_CFLAGS to compiler ltrim(): simplify function and fix situation when strings overlap in strcpy tx_operate_listbox(): use proper format string for size_t in snprintf
configure.ac | 3 +++ src/Makefile.am | 3 ++- src/ifaces.c | 6 ++---- src/ifstats.c | 2 +- src/iptraf.c | 2 +- src/promisc.c | 2 +- support/Makefile.am | 2 ++ support/listbox.c | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-)
--- src/iptraf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/iptraf.c b/src/iptraf.c index e0bb5c4..fb1d88f 100644 --- a/src/iptraf.c +++ b/src/iptraf.c @@ -496,7 +496,7 @@ int main(int argc, char **argv) int current_log_interval = 0;
#ifndef ALLOWUSERS - if (getuid() != 0) { + if (geteuid() != 0) { fprintf(stderr, "\nIPTraf Version %s\n", VERSION); fprintf(stderr, "Copyright (c) Gerard Paul Java 1997-2004l\n\n"); fprintf(stderr,
--- src/promisc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/promisc.c b/src/promisc.c index 4f2082c..137e3eb 100644 --- a/src/promisc.c +++ b/src/promisc.c @@ -49,7 +49,7 @@ void init_promisc_list(struct promisc_states **list) { FILE *fd; int ifd; - char buf[18]; + char buf[IF_NAMESIZE]; struct promisc_states *ptmp; struct promisc_states *tail = NULL; struct ifreq ifr;
--- src/ifstats.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/ifstats.c b/src/ifstats.c index 0dee48f..fc5eb54 100644 --- a/src/ifstats.c +++ b/src/ifstats.c @@ -1349,7 +1349,7 @@ void selectiface(char *ifname, int withall, int *aborted)
if ((withall) && (list != NULL)) { ptmp = malloc(sizeof(struct iflist)); - strcpy(ptmp->ifname, "All interfaces"); + strncpy(ptmp->ifname, "All interfaces", sizeof (ptmp->ifname));
ptmp->prev_entry = NULL; list->prev_entry = ptmp;
--- configure.ac | 3 +++ src/Makefile.am | 3 ++- support/Makefile.am | 2 ++ 3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac index 6681a7e..8f14873 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,9 @@ dnl checks for libraries PKG_CHECK_MODULES([ncurses],[ncurses]) PKG_CHECK_MODULES([libpanel],[panel])
+AC_SUBST([ncurses_CFLAGS]) +AC_SUBST([libpanel_CFLAGS]) + dnl checks for header files AC_CHECK_HEADERS([arpa/inet.h]) AC_CHECK_HEADERS([fcntl.h]) diff --git a/src/Makefile.am b/src/Makefile.am index bf2b4f6..cba7ae9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,7 +40,8 @@ iptraf_CFLAGS = $(CFLAGS) \ -Wall \ -std=gnu99 \ -pedantic \ - -I$(srcdir)/../support + -I$(srcdir)/../support \ + $(libpanel_CFLAGS)
iptraf_LDFLAGS = $(ncurses_LIBS) $(libpanel_LIBS) iptraf_LDADD = ../support/libtextbox.la diff --git a/support/Makefile.am b/support/Makefile.am index c1b3b34..3367559 100644 --- a/support/Makefile.am +++ b/support/Makefile.am @@ -4,6 +4,8 @@ NULL=
libtextbox_la_CFLAGS = \ -Wall -std=gnu99 -pedantic \ + $(libpanel_CFLAGS) \ + $(ncurses_CFLAGS) \ $(NULL)
libtextbox_la_LDFLAGS = -avoid-version
--- src/ifaces.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/ifaces.c b/src/ifaces.c index 8447f51..6c7fdd9 100644 --- a/src/ifaces.c +++ b/src/ifaces.c @@ -46,12 +46,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; }
--- support/listbox.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/support/listbox.c b/support/listbox.c index be87aa8..0edfa48 100644 --- a/support/listbox.c +++ b/support/listbox.c @@ -105,7 +105,7 @@ void tx_operate_listbox(struct scroll_list *list, doupdate();
while (!exitloop) { - snprintf(sp_buf, 9, "%%%dc", list->width - strlen(list->textptr->text) - 3); + snprintf(sp_buf, 9, "%%%zuc", list->width - strlen(list->textptr->text) - 3); snprintf(padding, MAX_TEXT_LENGTH - 1, sp_buf, ' '); wattrset(list->win, list->selectattr); mvwprintw(list->win, row, 0, " %s%s", list->textptr->text, padding);
On 03/24/2010 10:18 AM, Petr Uzel wrote:
Hi,
This series contains patches SUSE had accumulated for iptraf-3.x, now rebased to iptraf-ng. Patches are independent, so please pick what you think is suitable for you.
Thanks.
Petr Uzel (6): main(): allow regular users to run iptraf if the sticky-bit is set init_promisc_list(): use IF_NAMESIZE as size of buffer for interface name selectiface(): use strncpy to prevent buffer overflow and thus avoid gcc warning build: pass libpanel_CFLAGS and ncurses_CFLAGS to compiler ltrim(): simplify function and fix situation when strings overlap in strcpy tx_operate_listbox(): use proper format string for size_t in snprintf
configure.ac | 3 +++ src/Makefile.am | 3 ++- src/ifaces.c | 6 ++---- src/ifstats.c | 2 +- src/iptraf.c | 2 +- src/promisc.c | 2 +- support/Makefile.am | 2 ++ support/listbox.c | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-)
Iptraf-ng mailing list Iptraf-ng@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/iptraf-ng
Hello,
thank you a lot. This was all in my TODO.
iptraf-ng@lists.stg.fedorahosted.org