diff options
author | thomas <thomas@FreeBSD.org> | 2003-01-02 10:19:43 +0000 |
---|---|---|
committer | thomas <thomas@FreeBSD.org> | 2003-01-02 10:19:43 +0000 |
commit | c35e5c982ee6f57ac0459e221871447bbb663584 (patch) | |
tree | 6a669dd09851c48b9066497f33bec4db9af498e8 /lib/libc | |
parent | 8fa3036bdb3be790eaa5e1a4ffb8f33b84d973d4 (diff) | |
download | FreeBSD-src-c35e5c982ee6f57ac0459e221871447bbb663584.zip FreeBSD-src-c35e5c982ee6f57ac0459e221871447bbb663584.tar.gz |
In cgetmatch(3), return -1 if a NULL or 0-length name parameter is used.
This situation most notably arises in chkprintcap, when a /etc/printcap
entry has an empty rp= attribute. In that case, cgetmatch would enter
an infinite loop if any entry in the file has multiple names.
This causes lpd to hang at boot time on 5.0-DP2 when both conditions
are met (:rp=: and multiple names -- not necessarily on the same entry).
Reviewed by: roberto
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getcap.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index 3dbcd37..af05113 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -577,6 +577,9 @@ cgetmatch(const char *buf, const char *name) { const char *np, *bp; + if (name == NULL || *name == '\0') + return -1; + /* * Start search at beginning of record. */ |