summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2020-04-21 18:27:23 +1000
committerDarren Tucker <dtucker@dtucker.net>2020-04-21 18:28:19 +1000
commit8854724ccefc1fa16f10b37eda2e759c98148caa (patch)
treedf753f9db792d71f6b8b07d1863aa62b259cb0fc
parentd00d07b6744d3b4bb7aca46c734ecd670148da23 (diff)
Sync rev 1.49.
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--openbsd-compat/glob.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c
index 9dcc4442f..e89151789 100644
--- a/openbsd-compat/glob.c
+++ b/openbsd-compat/glob.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: glob.c,v 1.48 2019/02/04 16:45:40 millert Exp $ */ 1/* $OpenBSD: glob.c,v 1.49 2020/04/21 08:25:22 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 1989, 1993 3 * Copyright (c) 1989, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -833,7 +833,7 @@ globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
833 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { 833 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
834 /* first time around -- clear initial gl_offs items */ 834 /* first time around -- clear initial gl_offs items */
835 pathv += pglob->gl_offs; 835 pathv += pglob->gl_offs;
836 for (i = pglob->gl_offs; --i >= 0; ) 836 for (i = pglob->gl_offs; i > 0; i--)
837 *--pathv = NULL; 837 *--pathv = NULL;
838 } 838 }
839 pglob->gl_pathv = pathv; 839 pglob->gl_pathv = pathv;
@@ -845,7 +845,7 @@ globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
845 if (pglob->gl_statv == NULL && pglob->gl_offs > 0) { 845 if (pglob->gl_statv == NULL && pglob->gl_offs > 0) {
846 /* first time around -- clear initial gl_offs items */ 846 /* first time around -- clear initial gl_offs items */
847 statv += pglob->gl_offs; 847 statv += pglob->gl_offs;
848 for (i = pglob->gl_offs; --i >= 0; ) 848 for (i = pglob->gl_offs; i > 0; i--)
849 *--statv = NULL; 849 *--statv = NULL;
850 } 850 }
851 pglob->gl_statv = statv; 851 pglob->gl_statv = statv;