diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2021-11-28 10:54:06 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2021-11-30 17:52:59 +0000 |
commit | 416a3fc806f47b158b489bb44f7709fc44fa4f3e (patch) | |
tree | 55f4e5f3e7c60472a2aa82e2ebdecb772e400d7c | |
parent | 6a902614350d46b759fc09a88daf9aff11f79ee8 (diff) |
WriteSave: allocate enough room for full session_save_file in error
Clears warning from gcc 11.2:
saveutil.c: In function ‘WriteSave’:
saveutil.c:315:75: warning: ‘%s’ directive output may be truncated
writing up to 1023 bytes into a region of size 221 [-Wformat-truncation=]
315 | snprintf (msg, sizeof(msg), "%s: Error creating session save file %s",
| ^~
316 | Argv[0], session_save_file);
| ~~~~~~~~~~~~~~~~~
saveutil.c:315:9: note: ‘snprintf’ output 36 or more bytes (assuming 1059)
into a destination of size 256
315 | snprintf (msg, sizeof(msg), "%s: Error creating session save file %s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 | Argv[0], session_save_file);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | saveutil.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -310,7 +310,7 @@ WriteSave(const char *sm_id) if (!f) { - char msg[256]; + char msg[36 + sizeof(session_save_file)]; snprintf (msg, sizeof(msg), "%s: Error creating session save file %s", Argv[0], session_save_file); |