From c35e5c982ee6f57ac0459e221871447bbb663584 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 2 Jan 2003 10:19:43 +0000 Subject: 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 --- lib/libc/gen/getcap.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/libc/gen/getcap.c') 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. */ -- cgit v1.1