Skip to content

Commit

Permalink
ZendMM is infalliable, skip checks
Browse files Browse the repository at this point in the history
  • Loading branch information
NattyNarwhal committed Jan 20, 2025
1 parent aea69d2 commit 9488a27
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions win32/glob.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,7 @@ static int glob0(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
size_t n = pglob->gl_pathc - oldpathc;
size_t o = pglob->gl_offs + oldpathc;

if ((path_stat = ecalloc(n, sizeof(*path_stat))) == NULL)
return GLOB_NOSPACE;
path_stat = ecalloc(n, sizeof(*path_stat));
for (i = 0; i < n; i++) {
path_stat[i].gps_path = pglob->gl_pathv[o + i];
path_stat[i].gps_stat = pglob->gl_statv[o + i];
Expand Down Expand Up @@ -841,8 +840,6 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
}

pathv = safe_erealloc_rel(pglob->gl_pathv, newn, sizeof(*pathv), 0);
if (pathv == NULL)
goto nospace;
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
pathv += pglob->gl_offs;
Expand Down Expand Up @@ -871,9 +868,8 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
errno = 0;
return(GLOB_NOSPACE);
}
if ((statv[pglob->gl_offs + pglob->gl_pathc] =
emalloc(sizeof(**statv))) == NULL)
goto copy_error;
statv[pglob->gl_offs + pglob->gl_pathc] =
emalloc(sizeof(**statv));
memcpy(statv[pglob->gl_offs + pglob->gl_pathc], sb,
sizeof(*sb));
}
Expand All @@ -884,13 +880,12 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
;
len = (size_t)(p - path);
limitp->glim_malloc += len;
if ((copy = emalloc(len)) != NULL) {
if (g_Ctoc(path, copy, len)) {
efree(copy);
return(GLOB_NOSPACE);
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
copy = emalloc(len);
if (g_Ctoc(path, copy, len)) {
efree(copy);
return(GLOB_NOSPACE);
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;

if ((pglob->gl_flags & GLOB_LIMIT) &&
Expand Down

0 comments on commit 9488a27

Please sign in to comment.