forked from kyonshi/grenzland-mud
Fix format overflow issues (#52)
Replace a few sprintf calls with snprintf to prevent buffer overflow. Added error messages to the logs where buffer size prevents a room, object, mobile, or quest from being saved to disk.
This commit is contained in:
@@ -1196,7 +1196,7 @@ static int Crash_load_objs(struct char_data *ch) {
|
||||
|
||||
if (!(fl = fopen(filename, "r"))) {
|
||||
if (errno != ENOENT) { /* if it fails, NOT because of no file */
|
||||
sprintf(buf, "SYSERR: READING OBJECT FILE %s (5)", filename);
|
||||
snprintf(buf, MAX_STRING_LENGTH, "SYSERR: READING OBJECT FILE %s (5)", filename);
|
||||
perror(buf);
|
||||
send_to_char(ch, "\r\n********************* NOTICE *********************\r\n"
|
||||
"There was a problem loading your objects from disk.\r\n"
|
||||
|
||||
Reference in New Issue
Block a user