mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
strcpy shouldn't be used for overlapping strings
This commit is contained in:
parent
2afe66ed01
commit
f7568b0753
@ -6693,10 +6693,13 @@ static FILE *open_config_file(const char *f)
|
||||
void remove_comments(char *string) {
|
||||
char *curplace;
|
||||
char *newend = NULL;
|
||||
char *tmpstring; //strcpy can't be used for overlapping strings
|
||||
|
||||
for(curplace = string; *curplace != 0; curplace++) {
|
||||
if(*curplace == '\\' && *(curplace + 1) == '#') {
|
||||
strcpy(curplace, curplace + 1);
|
||||
tmpstring = strdup(curplace);
|
||||
strcpy(curplace, tmpstring + 1);
|
||||
free(tmpstring);
|
||||
} else if(*curplace == '#' && !newend) {
|
||||
newend = curplace;
|
||||
} else if(*curplace == '\n' && newend) {
|
||||
|
Loading…
Reference in New Issue
Block a user