1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Fix the -f option when passed multiple files.

Found by robert@
This commit is contained in:
millert 2022-02-09 15:53:35 +00:00
parent 43496f5abc
commit be07b65e94

View File

@ -1,4 +1,4 @@
/* $OpenBSD: getcap.c,v 1.8 2019/01/25 00:19:26 millert Exp $ */
/* $OpenBSD: getcap.c,v 1.9 2022/02/09 15:53:35 millert Exp $ */
/*
* Copyright (c) 2005 Todd C. Miller <millert@openbsd.org>
@ -77,7 +77,7 @@ main(int argc, char *argv[])
if (pathvec != NULL)
errx(1, "only one -f option may be specified");
for (n = 1, cp = optarg; (cp = strchr(cp, ':')); n++)
continue;
cp++;
pathvec = calloc(n + 1, sizeof(char *));
for (n = 0; (pathvec[n] = strsep(&optarg, ":"));) {
if (*pathvec[n] != '\0')