Fixed source and destination overlap in sprintf() (i.e. in strcpy() inside)

This commit is contained in:
AlexeyAB 2019-11-15 23:33:16 +03:00
parent 3555beb914
commit 71e8354589
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ void find_replace_extension(char *str, char *orig, char *rep, char *output)
int offset = (p - buffer);
int chars_from_end = strlen(buffer) - offset;
if (!p || chars_from_end != strlen(orig)) { // Is 'orig' even in 'str' AND is 'orig' found at the end of 'str'?
sprintf(output, "%s", str);
sprintf(output, "%s", buffer);
free(buffer);
return;
}