diff options
author | Akinori MUSHA <knu@FreeBSD.org> | 2002-01-21 16:02:52 +0000 |
---|---|---|
committer | Akinori MUSHA <knu@FreeBSD.org> | 2002-01-21 16:02:52 +0000 |
commit | 94f005e72378f5e19b269c23ff9abf1980ffae0f (patch) | |
tree | 575e10b0131e11dc779098f96c7199dcbc79c6c4 | |
parent | Update to 0.18, minor fixes. (diff) |
Add a patch submitted by the author which fixes a bug I reported where
fd occasionally dies of a segfault caused by a buffer overrun on
command invocation.
Bump PORTREVISION accordingly.
-rw-r--r-- | misc/fd/Makefile | 2 | ||||
-rw-r--r-- | misc/fd/files/patch-parse.c | 48 | ||||
-rw-r--r-- | shells/fd/Makefile | 2 | ||||
-rw-r--r-- | shells/fd/files/patch-parse.c | 48 |
4 files changed, 98 insertions, 2 deletions
diff --git a/misc/fd/Makefile b/misc/fd/Makefile index 0b9dd5ea8754..10b7725a67ae 100644 --- a/misc/fd/Makefile +++ b/misc/fd/Makefile @@ -7,7 +7,7 @@ PORTNAME= fd PORTVERSION= 1.03u -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= misc MASTER_SITES= http://hp.vector.co.jp/authors/VA012337/soft/fd/ \ ftp://ftp.vector.co.jp/pack/unix/util/file/filer/fd/ diff --git a/misc/fd/files/patch-parse.c b/misc/fd/files/patch-parse.c new file mode 100644 index 000000000000..4e809b6e64d6 --- /dev/null +++ b/misc/fd/files/patch-parse.c @@ -0,0 +1,48 @@ +diff -u ../old/FD-1.03u/parse.c ./parse.c +--- ../old/FD-1.03u/parse.c Tue Dec 18 00:00:00 2001 ++++ ./parse.c Mon Jan 21 10:15:02 2002 +@@ -322,11 +322,16 @@ + epath = next = NULL; + size = 0; + for (cp = path; cp && *cp; cp = next) { +- next = strtkbrk(cp, delim, 0); +- len = (next) ? (next++) - cp : strlen(cp); +- if (!len) next = cp; ++ if ((next = strtkbrk(cp, delim, 0))) { ++ len = next - cp; ++ for (i = 1; next[i] && strchr(delim, next[i]); i++); ++ } + else { +- next = cp + len; ++ len = strlen(cp); ++ i = 0; ++ } ++ next = cp + len; ++ if (len) { + tmp = _evalpath(cp, next, 0, 0); + # if !MSDOS && !defined (_NOKANJIFCONV) + cp = kanjiconv2(buf, tmp, +@@ -336,17 +341,18 @@ + # endif + len = strlen(cp); + } +- for (i = 1; next[i] && strchr(delim, next[i]); i++); + + epath = (char *)realloc2(epath, size + len + i + 1); + if (len) { + strcpy(epath + size, cp); + free(tmp); ++ size += len; ++ } ++ if (i) { ++ strncpy(epath + size, next, i); ++ size += i; ++ next += i; + } +- size += len; +- strncpy(epath + size, next, i); +- size += i; +- next += i; + } + + if (!epath) return(strdup2("")); diff --git a/shells/fd/Makefile b/shells/fd/Makefile index 0b9dd5ea8754..10b7725a67ae 100644 --- a/shells/fd/Makefile +++ b/shells/fd/Makefile @@ -7,7 +7,7 @@ PORTNAME= fd PORTVERSION= 1.03u -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= misc MASTER_SITES= http://hp.vector.co.jp/authors/VA012337/soft/fd/ \ ftp://ftp.vector.co.jp/pack/unix/util/file/filer/fd/ diff --git a/shells/fd/files/patch-parse.c b/shells/fd/files/patch-parse.c new file mode 100644 index 000000000000..4e809b6e64d6 --- /dev/null +++ b/shells/fd/files/patch-parse.c @@ -0,0 +1,48 @@ +diff -u ../old/FD-1.03u/parse.c ./parse.c +--- ../old/FD-1.03u/parse.c Tue Dec 18 00:00:00 2001 ++++ ./parse.c Mon Jan 21 10:15:02 2002 +@@ -322,11 +322,16 @@ + epath = next = NULL; + size = 0; + for (cp = path; cp && *cp; cp = next) { +- next = strtkbrk(cp, delim, 0); +- len = (next) ? (next++) - cp : strlen(cp); +- if (!len) next = cp; ++ if ((next = strtkbrk(cp, delim, 0))) { ++ len = next - cp; ++ for (i = 1; next[i] && strchr(delim, next[i]); i++); ++ } + else { +- next = cp + len; ++ len = strlen(cp); ++ i = 0; ++ } ++ next = cp + len; ++ if (len) { + tmp = _evalpath(cp, next, 0, 0); + # if !MSDOS && !defined (_NOKANJIFCONV) + cp = kanjiconv2(buf, tmp, +@@ -336,17 +341,18 @@ + # endif + len = strlen(cp); + } +- for (i = 1; next[i] && strchr(delim, next[i]); i++); + + epath = (char *)realloc2(epath, size + len + i + 1); + if (len) { + strcpy(epath + size, cp); + free(tmp); ++ size += len; ++ } ++ if (i) { ++ strncpy(epath + size, next, i); ++ size += i; ++ next += i; + } +- size += len; +- strncpy(epath + size, next, i); +- size += i; +- next += i; + } + + if (!epath) return(strdup2("")); |