mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-24 00:04:07 +01:00
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:
parent
bf941bc9b2
commit
ad88f94a46
6 changed files with 70 additions and 46 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue