mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Move pattern length check until after we have initialized the glob_t
so we can call globfree() even on error. From Frank Denis.
This commit is contained in:
@@ -203,9 +203,6 @@ sudo_glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
|
||||
Char *bufnext, *bufend, patbuf[PATH_MAX];
|
||||
struct glob_lim limit = { 0, 0, 0 };
|
||||
|
||||
if (strnlen(pattern, PATH_MAX) == PATH_MAX)
|
||||
return GLOB_NOMATCH;
|
||||
|
||||
patnext = (unsigned char *) pattern;
|
||||
if (!(flags & GLOB_APPEND)) {
|
||||
pglob->gl_pathc = 0;
|
||||
@@ -222,6 +219,9 @@ sudo_glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
|
||||
pglob->gl_pathc >= INT_MAX - pglob->gl_offs - 1)
|
||||
return GLOB_NOSPACE;
|
||||
|
||||
if (strnlen(pattern, PATH_MAX) == PATH_MAX)
|
||||
return GLOB_NOMATCH;
|
||||
|
||||
bufnext = patbuf;
|
||||
bufend = bufnext + PATH_MAX - 1;
|
||||
if (flags & GLOB_NOESCAPE)
|
||||
|
Reference in New Issue
Block a user