diff options
author | wiz <wiz@pkgsrc.org> | 2000-09-09 02:53:10 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2000-09-09 02:53:10 +0000 |
commit | 407a54e313088c7419e50fb05d084d3a0dce9e1b (patch) | |
tree | 8fc288b33dd6bae8dc962b44e0d732a1b0ad2f3f /misc | |
parent | 95cd526b745fba714fd3b1f372088b3c1bafed17 (diff) | |
download | pkgsrc-407a54e313088c7419e50fb05d084d3a0dce9e1b.tar.gz |
fix coredump on empty lines, warn if files given on commandline are not
in checksum file
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cksfv/files/patch-sum | 4 | ||||
-rw-r--r-- | misc/cksfv/patches/patch-ad | 49 |
2 files changed, 42 insertions, 11 deletions
diff --git a/misc/cksfv/files/patch-sum b/misc/cksfv/files/patch-sum index 634d7902be1..c27a7f0be64 100644 --- a/misc/cksfv/files/patch-sum +++ b/misc/cksfv/files/patch-sum @@ -1,6 +1,6 @@ -$NetBSD: patch-sum,v 1.1.1.1 2000/08/13 22:03:07 wiz Exp $ +$NetBSD: patch-sum,v 1.2 2000/09/09 02:53:10 wiz Exp $ MD5 (patch-aa) = 412d245c2e30f25e90ee18c4948c864a MD5 (patch-ac) = 3ba80a0d46fd5298fce62c7cc9ff1b73 -MD5 (patch-ad) = f8e999203803dd7f52de3805e20dbf74 +MD5 (patch-ad) = a9ff722715c4abdf2600feec9324eb37 MD5 (patch-ae) = 1788e7929bfc7cab88d49d01612ee529 diff --git a/misc/cksfv/patches/patch-ad b/misc/cksfv/patches/patch-ad index 7a4fa34473e..00a7dfbb881 100644 --- a/misc/cksfv/patches/patch-ad +++ b/misc/cksfv/patches/patch-ad @@ -1,7 +1,7 @@ -$NetBSD: patch-ad,v 1.1.1.1 2000/08/13 22:03:07 wiz Exp $ +$NetBSD: patch-ad,v 1.2 2000/09/09 02:53:10 wiz Exp $ ---- src/readsfv.c.orig Thu Aug 10 22:50:02 2000 -+++ src/readsfv.c Thu Aug 10 23:01:30 2000 +--- src/readsfv.c.orig Mon May 22 23:57:05 2000 ++++ src/readsfv.c Sat Sep 9 04:43:44 2000 @@ -33,12 +33,13 @@ extern int verbose; @@ -17,13 +17,31 @@ $NetBSD: patch-ad,v 1.1.1.1 2000/08/13 22:03:07 wiz Exp $ unsigned long len, val, sfvcrc; struct dirent *dirinfo; -@@ -79,6 +80,19 @@ +@@ -67,17 +68,35 @@ + } + + while(fgets(buf, 512, fd)) { +- if (buf[0] != ';') { /* comment in the sfv file ignore */ ++ if (buf[0] != ';' && buf[0] != '\n') { /* comment or empty line, ignore */ + /* build filename and crc from the sfv file */ + end = strrchr(buf, ' '); +- if (end == NULL) { ++ if (end == NULL || end-buf > 512-10) { + fprintf(stderr, "cksfv: %s: incorrect sfv file format\n", fn); ++ continue; + } + *end = '\0'; + *(end+9) = '\0'; + strncpy(crc, ++end, 9); strncpy(filename, buf, 512); - sfvcrc = strtoul(crc, '\0', 16); - +- sfvcrc = strtoul(crc, '\0', 16); ++ sfvcrc = strtoul(crc, NULL, 16); ++ + if (argc) { + check = 0; + for (i=0; i<argc; i++) { ++ if (argv[i] == NULL) ++ continue; + if ((nocase == 1 && strcasecmp(argv[i], filename) == 0) + || (nocase == 0 && strcmp(argv[i], filename) == 0)) { + check = 1; @@ -32,17 +50,30 @@ $NetBSD: patch-ad,v 1.1.1.1 2000/08/13 22:03:07 wiz Exp $ + } + if (check == 0) + continue; ++ else ++ argv[i] = NULL; + } -+ + if (nocase == 1) { len = strlen(filename); - while ((dirinfo = readdir(dirp)) != NULL) { -@@ -126,6 +140,8 @@ +@@ -126,6 +145,20 @@ } } fclose(fd); + if (nocase == 1) + closedir(dirp); ++ ++ if (argc) { ++ for (i=0; i<argc; i++) { ++ if (argv[i]) { ++ if (verbose == 1) ++ fprintf(stderr, "%-49s not found in sfv\n", argv[i]); ++ else ++ fprintf(stderr, "cksfv: %s: not found in sfv\n", argv[i]); ++ rval = 1; ++ } ++ } ++ } if (verbose == 1) { if (rval == 0) { |