summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2020-04-21 08:25:23 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2020-04-21 08:25:23 +0000
commitd8ec607351e1ff7cc89e243ece824fc3a0d05bc1 (patch)
treedb5c2b6bf859385849d20c16816f69758fd9f5d8
parent23fe510ac217bd354f1a45bc4df2561af0e84585 (diff)
Prevent infinite for loop since i went from ssize_t to size_t. Patch from
eagleoflqj via OpenSSH github PR#178, ok djm@, feedback & ok millert@
-rw-r--r--lib/libc/gen/glob.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index 8b69031d54f..58ece51059f 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.c,v 1.48 2019/02/04 16:45:40 millert Exp $ */
+/* $OpenBSD: glob.c,v 1.49 2020/04/21 08:25:22 dtucker Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -819,7 +819,7 @@ globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
pathv += pglob->gl_offs;
- for (i = pglob->gl_offs; --i >= 0; )
+ for (i = pglob->gl_offs; i > 0; i--)
*--pathv = NULL;
}
pglob->gl_pathv = pathv;
@@ -831,7 +831,7 @@ globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
if (pglob->gl_statv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
statv += pglob->gl_offs;
- for (i = pglob->gl_offs; --i >= 0; )
+ for (i = pglob->gl_offs; i > 0; i--)
*--statv = NULL;
}
pglob->gl_statv = statv;