Skip to content

Commit

Permalink
Fix strcpy-param-overlap
Browse files Browse the repository at this point in the history
Found by: michaelortmann
Patch by: michaelortmann
  • Loading branch information
michaelortmann authored Oct 1, 2023
1 parent 7023978 commit 45445f2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,7 @@ void splitcn(char *first, char *rest, char divider, size_t max)
if (first != NULL)
strlcpy(first, rest, max);
if (first != rest)
/* In most circumstances, strcpy with src and dst being the same buffer
* can produce undefined results. We're safe here, as the src is
* guaranteed to be at least 2 bytes higher in memory than dest. <Cybah>
*/
strcpy(rest, p + 1);
memmove(rest, p + 1, strlen(p + 1) + 1);
}

char *splitnick(char **blah)
Expand Down

0 comments on commit 45445f2

Please sign in to comment.