pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/nfdump Improve portability and while here, fix a r...
details: https://anonhg.NetBSD.org/pkgsrc/rev/9110d351814f
branches: trunk
changeset: 532137:9110d351814f
user: joerg <joerg%pkgsrc.org@localhost>
date: Sun Aug 12 13:57:35 2007 +0000
description:
Improve portability and while here, fix a rather obvious buffer overflow
in the argument handling. No idea how this was supposed to work, but
consider running it in / with relative arguments.
Bump revision.
diffstat:
net/nfdump/Makefile | 3 +-
net/nfdump/distinfo | 4 ++-
net/nfdump/patches/patch-ae | 52 +++++++++++++++++++++++++++++++++++++++++++++
net/nfdump/patches/patch-af | 52 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 109 insertions(+), 2 deletions(-)
diffs (140 lines):
diff -r ba25f71dc26b -r 9110d351814f net/nfdump/Makefile
--- a/net/nfdump/Makefile Sun Aug 12 13:36:36 2007 +0000
+++ b/net/nfdump/Makefile Sun Aug 12 13:57:35 2007 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.1.1.1 2007/07/29 21:33:42 seb Exp $
+# $NetBSD: Makefile,v 1.2 2007/08/12 13:57:35 joerg Exp $
#
DISTNAME= nfdump-1.5.2
+PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=nfdump/}
diff -r ba25f71dc26b -r 9110d351814f net/nfdump/distinfo
--- a/net/nfdump/distinfo Sun Aug 12 13:36:36 2007 +0000
+++ b/net/nfdump/distinfo Sun Aug 12 13:57:35 2007 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1.1.1 2007/07/29 21:33:42 seb Exp $
+$NetBSD: distinfo,v 1.2 2007/08/12 13:57:35 joerg Exp $
SHA1 (nfdump-1.5.2.tar.gz) = 180a3b8b2315b5c4d0beb07e5b17817f4bdbb454
RMD160 (nfdump-1.5.2.tar.gz) = 0fac8ba1dc75163b7d906453581e345e037b3730
@@ -7,3 +7,5 @@
SHA1 (patch-ab) = 3b5a57e3384208d5aee2a6741d664ec5b31640ab
SHA1 (patch-ac) = bba19ce3e28b0d74d06ae694790e7aaeb73bfc6b
SHA1 (patch-ad) = e9aee08cb58dd541c2d2ca23c0a544f8c8645421
+SHA1 (patch-ae) = 5d9c6da56dece4f4073fb72b7c8ba8042754908c
+SHA1 (patch-af) = 78d0a0d5f93cbe9ec9e93ffc9f10f51743f20fc3
diff -r ba25f71dc26b -r 9110d351814f net/nfdump/patches/patch-ae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/nfdump/patches/patch-ae Sun Aug 12 13:57:35 2007 +0000
@@ -0,0 +1,52 @@
+$NetBSD: patch-ae,v 1.1 2007/08/12 13:57:35 joerg Exp $
+
+--- nfcapd.c.orig 2007-08-12 13:25:39.000000000 +0000
++++ nfcapd.c
+@@ -71,6 +71,7 @@
+ #include <sys/mman.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <limits.h>
+
+ #include "config.h"
+
+@@ -511,7 +512,11 @@ int main(int argc, char **argv) {
+
+ char *bindhost, *filter, *datadir, pidstr[32], *lauch_process;
+ char *userid, *groupid, *checkptr, *listenport, *mcastgroup;
+-char pidfile[MAXNAMLEN];
++#ifdef PATH_MAX
++char pidfile[PATH_MAX];
++#else
++char pidfile[MAXPATHLEN];
++#endif
+ struct stat fstat;
+ srecord_t *commbuff;
+ struct sigaction act;
+@@ -587,18 +592,20 @@ pid_t pid;
+ break;
+ case 'P':
+ if ( optarg[0] == '/' ) { // absolute path given
+- strncpy(pidfile, optarg, MAXNAMLEN-1);
++ strncpy(pidfile, optarg, sizeof(pidfile));
++ pidfile[sizeof(pidfile) - 1] = 0;
+ } else { // path relative to current working directory
++#ifdef PATH_MAX
++ char tmp[PATH_MAX];
++#else
+ char tmp[MAXPATHLEN];
+- if ( !getcwd(tmp, MAXPATHLEN-1) ) {
++#endif
++ if ( !getcwd(tmp, sizeof(tmp)) ) {
+ fprintf(stderr, "Failed to get current working directory: %s\n", strerror(errno));
+ exit(255);
+ }
+- tmp[MAXPATHLEN-1] = 0;
+- snprintf(pidfile, MAXPATHLEN - 1 - strlen(tmp), "%s/%s", tmp, optarg);
++ snprintf(pidfile, sizeof(pidfile), "%s/%s", tmp, optarg);
+ }
+- // pidfile now absolute path
+- pidfile[MAXNAMLEN-1] = 0;
+ break;
+ case 'r':
+ report_sequence = 1;
diff -r ba25f71dc26b -r 9110d351814f net/nfdump/patches/patch-af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/nfdump/patches/patch-af Sun Aug 12 13:57:35 2007 +0000
@@ -0,0 +1,52 @@
+$NetBSD: patch-af,v 1.1 2007/08/12 13:57:36 joerg Exp $
+
+--- sfcapd.c.orig 2007-08-12 13:30:13.000000000 +0000
++++ sfcapd.c
+@@ -60,6 +60,7 @@
+ #include <sys/mman.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <limits.h>
+
+ #include "config.h"
+
+@@ -454,7 +455,11 @@ int main(int argc, char **argv) {
+
+ char *bindhost, *filter, *datadir, pidstr[32], *lauch_process;
+ char *userid, *groupid, *checkptr, *listenport, *mcastgroup;
+-char pidfile[MAXNAMLEN];
++#ifdef PATH_MAX
++char pidfile[PATH_MAX];
++#else
++char pidfile[MAXPATHLEN];
++#endif
+ struct stat fstat;
+ srecord_t *commbuff;
+ struct sigaction act;
+@@ -530,18 +535,20 @@ pid_t pid;
+ break;
+ case 'P':
+ if ( optarg[0] == '/' ) { // absolute path given
+- strncpy(pidfile, optarg, MAXNAMLEN-1);
++ strncpy(pidfile, optarg, sizeof(pidfile));
++ pidfile[sizeof(pidfile) - 1] = '\0'
+ } else { // path relative to current working directory
++#ifdef PATH_MAX
++ char tmp[PATH_MAX]
++#else
+ char tmp[MAXPATHLEN];
+- if ( !getcwd(tmp, MAXPATHLEN-1) ) {
++#endif
++ if ( !getcwd(tmp, sizeof(tmp)) ) {
+ fprintf(stderr, "Failed to get current working directory: %s\n", strerror(errno));
+ exit(255);
+ }
+- tmp[MAXPATHLEN-1] = 0;
+- snprintf(pidfile, MAXPATHLEN - 1 - strlen(tmp), "%s/%s", tmp, optarg);
++ snprintf(pidfile, sizeof(pidfile), "%s/%s", tmp, optarg);
+ }
+- // pidfile now absolute path
+- pidfile[MAXNAMLEN-1] = 0;
+ break;
+ case 'r':
+ report_sequence = 1;
Home |
Main Index |
Thread Index |
Old Index