diff options
author | joerg <joerg@pkgsrc.org> | 2007-08-12 13:57:35 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-08-12 13:57:35 +0000 |
commit | 64042495c842e1c007fa64afd8ce722d6aae2b6c (patch) | |
tree | 768f521a00e5a28a7e6ddb4f594b966cb8a81479 /net | |
parent | fa8a956e56e7bb0e3a1108791691a238730a4c7c (diff) | |
download | pkgsrc-64042495c842e1c007fa64afd8ce722d6aae2b6c.tar.gz |
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 (limited to 'net')
-rw-r--r-- | net/nfdump/Makefile | 3 | ||||
-rw-r--r-- | net/nfdump/distinfo | 4 | ||||
-rw-r--r-- | net/nfdump/patches/patch-ae | 52 | ||||
-rw-r--r-- | net/nfdump/patches/patch-af | 52 |
4 files changed, 109 insertions, 2 deletions
diff --git a/net/nfdump/Makefile b/net/nfdump/Makefile index 8dcd6baba9a..93476a402e1 100644 --- a/net/nfdump/Makefile +++ b/net/nfdump/Makefile @@ -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 --git a/net/nfdump/distinfo b/net/nfdump/distinfo index d58e2451c07..fe2b18bda11 100644 --- a/net/nfdump/distinfo +++ b/net/nfdump/distinfo @@ -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-aa) = eb506648e2539092a51df964cd8096b74b4b940d SHA1 (patch-ab) = 3b5a57e3384208d5aee2a6741d664ec5b31640ab SHA1 (patch-ac) = bba19ce3e28b0d74d06ae694790e7aaeb73bfc6b SHA1 (patch-ad) = e9aee08cb58dd541c2d2ca23c0a544f8c8645421 +SHA1 (patch-ae) = 5d9c6da56dece4f4073fb72b7c8ba8042754908c +SHA1 (patch-af) = 78d0a0d5f93cbe9ec9e93ffc9f10f51743f20fc3 diff --git a/net/nfdump/patches/patch-ae b/net/nfdump/patches/patch-ae new file mode 100644 index 00000000000..68d623ce554 --- /dev/null +++ b/net/nfdump/patches/patch-ae @@ -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 --git a/net/nfdump/patches/patch-af b/net/nfdump/patches/patch-af new file mode 100644 index 00000000000..c3d62e58a76 --- /dev/null +++ b/net/nfdump/patches/patch-af @@ -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; |