forked from kyonshi/grenzland-mud
Resolve Wrestrict warnings on GCC 8.1.1 (#51)
* Fix several misleading indentation warnings on GCC 8.1.1 * Fix reliance on undefined strcpy/sprintf behavior (-Wrestrict warnings) The standard states that strcpy results in undefined behavior when the source and destination buffers overlap. I resolved this with a combination of memmove and strlen. Note that the resulting code is slightly less efficient. Similarly, sprintf's behavior is undefined when copying takes place between objects that overlap. I replaced most of these with a simple strcat, though one required a temp buffer. * Fix format in improved-edit.c to match surrounding code
This commit is contained in:
@@ -476,7 +476,8 @@ static void script_syntax_highlighting(struct descriptor_data *d, char *string)
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buffer, "%s%s\tn\r\n", buffer, line);
|
||||
strcat(buffer, line);
|
||||
strcat(buffer, "\tn\r\n");
|
||||
}
|
||||
|
||||
page_string(d, buffer, TRUE);
|
||||
|
||||
Reference in New Issue
Block a user