diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index 3dbcd3777d1d..af051135e239 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. */