search for: expdir_len

Displaying 4 results from an estimated 4 matches for "expdir_len".

2019 Jan 25
0
[klibc:update-dash] expand: Fix buffer overflow in expandmeta
...r_max = len + PATH_MAX; + expdir = ckmalloc(expdir_max); - expmeta(expdir, p); + expmeta(p, len, 0); ckfree(expdir); if (p != str->text) ckfree(p); @@ -1304,8 +1305,9 @@ nometa: */ STATIC void -expmeta(char *enddir, char *name) +expmeta(char *name, unsigned name_len, unsigned expdir_len) { + char *enddir = expdir + expdir_len; char *p; const char *cp; char *start; @@ -1348,15 +1350,15 @@ expmeta(char *enddir, char *name) } } if (metaflag == 0) { /* we've reached the end of the file name */ - if (enddir != expdir) - metaflag++; + if (!expdir_len) + return;...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix buffer overflow in expandmeta
...r_max = len + PATH_MAX; + expdir = ckmalloc(expdir_max); - expmeta(expdir, p); + expmeta(p, len, 0); ckfree(expdir); if (p != str->text) ckfree(p); @@ -1304,8 +1305,9 @@ nometa: */ STATIC void -expmeta(char *enddir, char *name) +expmeta(char *name, unsigned name_len, unsigned expdir_len) { + char *enddir = expdir + expdir_len; char *p; const char *cp; char *start; @@ -1348,15 +1350,15 @@ expmeta(char *enddir, char *name) } } if (metaflag == 0) { /* we've reached the end of the file name */ - if (enddir != expdir) - metaflag++; + if (!expdir_len) + return;...
2019 Jan 25
0
[klibc:update-dash] expand: Do not quote backslashes in unquoted parameter expansion
...p; EXP_FULL) || syntax != BASESYNTAX) && - syntax[c] == CBACK))) + (syntax != BASESYNTAX && syntax[c] == CBACK))) USTPUTC(CTLESC, q); } else if (!(quotes & QUOTES_KEEPNUL)) continue; @@ -1341,7 +1340,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) } } } else { - if (*p == '\\') + if (*p == '\\' && p[1]) esc++; if (p[esc] == '/') { if (metaflag) @@ -1355,7 +1354,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) return; p = name; do { - if (*p == '\\&...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not quote backslashes in unquoted parameter expansion
...p; EXP_FULL) || syntax != BASESYNTAX) && - syntax[c] == CBACK))) + (syntax != BASESYNTAX && syntax[c] == CBACK))) USTPUTC(CTLESC, q); } else if (!(quotes & QUOTES_KEEPNUL)) continue; @@ -1341,7 +1340,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) } } } else { - if (*p == '\\') + if (*p == '\\' && p[1]) esc++; if (p[esc] == '/') { if (metaflag) @@ -1355,7 +1354,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) return; p = name; do { - if (*p == '\\&...