Skip to content

Commit

Permalink
Fix wide buffer growth when expanding filenames.
Browse files Browse the repository at this point in the history
Closes: #39
  • Loading branch information
lichray committed Dec 8, 2021
1 parent d87f4fa commit 5fcdc13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ex/ex_argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,11 @@ err: if (ifp != NULL)
* shell that does that is broken.
*/
for (p = bp, len = 0, ch = EOF;
(ch = GETC(ifp)) != EOF; *p++ = ch, blen-=sizeof(CHAR_T), ++len)
(ch = GETC(ifp)) != EOF; *p++ = ch, blen -= sizeof(CHAR_T), ++len)
if (blen < 5) {
ADD_SPACE_GOTOW(sp, bp, *blenp, *blenp * 2);
ADD_SPACE_GOTO(sp, CHAR_T, bp, *blenp, *blenp * 2);
p = bp + len;
blen = *blenp - len;
blen = *blenp - len * sizeof(CHAR_T);
}

/* Delete the final newline, nul terminate the string. */
Expand Down

0 comments on commit 5fcdc13

Please sign in to comment.