Skip to content

Commit

Permalink
Merge pull request #78 from chipweinberger/master
Browse files Browse the repository at this point in the history
stack corruption for long cmdline args
  • Loading branch information
tomghuang committed Oct 23, 2022
2 parents d0936c6 + f319bb6 commit f25c624
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/argtable3.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ static void arg_cat(char** pdest, const char* src, size_t* pndest) {
char* end = dest + *pndest;

/*locate null terminator of dest string */
while (dest < end && *dest != 0)
while (dest < end-1 && *dest != 0)
dest++;

/* concat src string to dest string */
while (dest < end && *src != 0)
while (dest < end-1 && *src != 0)
*dest++ = *src++;

/* null terminate dest string */
Expand Down

0 comments on commit f25c624

Please sign in to comment.