diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2022-07-11 19:35:10 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2022-07-11 19:35:10 -0400 |
commit | 840fb4d47b612f53f46ef1bea2fac17a4dcf5ce5 (patch) | |
tree | 923aae570c5e53728128bf2ce6b0ec0720cb7a1e | |
parent | 632af4837e67ec9c2cd1b8edd177e6c4ce9f1fb6 (diff) | |
download | rockbox-840fb4d47b612f53f46ef1bea2fac17a4dcf5ce5.tar.gz rockbox-840fb4d47b612f53f46ef1bea2fac17a4dcf5ce5.zip |
doom: Fix a potential buffer trashing in the doom plugin
(caught by GCC12's -Waddress)
Change-Id: I122b44324c60c668ed4a066aa6301d40cb7597ba
-rw-r--r-- | apps/plugins/doom/d_deh.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/plugins/doom/d_deh.c b/apps/plugins/doom/d_deh.c index 1a399e3b49..0a67aa0aad 100644 --- a/apps/plugins/doom/d_deh.c +++ b/apps/plugins/doom/d_deh.c | |||
@@ -63,7 +63,7 @@ char* strlwr(char* str) | |||
63 | typedef struct { | 63 | typedef struct { |
64 | const byte *inp; // Pointer to string | 64 | const byte *inp; // Pointer to string |
65 | size_t size; // Bytes remaining in string | 65 | size_t size; // Bytes remaining in string |
66 | int fd; // Current file descriptor | 66 | int fd; // Current file descriptor |
67 | } DEHFILE; | 67 | } DEHFILE; |
68 | 68 | ||
69 | // killough 10/98: emulate IO whether input really comes from a file or not | 69 | // killough 10/98: emulate IO whether input really comes from a file or not |
@@ -2868,6 +2868,7 @@ boolean deh_GetData(char *s, char *k, uint_64_t *l, char **strval, int fpout) | |||
2868 | if (*t == '=') break; | 2868 | if (*t == '=') break; |
2869 | buffer[i] = *t; // copy it | 2869 | buffer[i] = *t; // copy it |
2870 | } | 2870 | } |
2871 | if (i == 0) i = 1; /* Just in case */ | ||
2871 | buffer[--i] = '\0'; // terminate the key before the '=' | 2872 | buffer[--i] = '\0'; // terminate the key before the '=' |
2872 | if (!*t) // end of string with no equal sign | 2873 | if (!*t) // end of string with no equal sign |
2873 | { | 2874 | { |