forked from len0rd/rockbox
doom: Fix a potential buffer trashing in the doom plugin
(caught by GCC12's -Waddress) Change-Id: I122b44324c60c668ed4a066aa6301d40cb7597ba
This commit is contained in:
parent
632af4837e
commit
840fb4d47b
1 changed files with 2 additions and 1 deletions
|
@ -63,7 +63,7 @@ char* strlwr(char* str)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const byte *inp; // Pointer to string
|
const byte *inp; // Pointer to string
|
||||||
size_t size; // Bytes remaining in string
|
size_t size; // Bytes remaining in string
|
||||||
int fd; // Current file descriptor
|
int fd; // Current file descriptor
|
||||||
} DEHFILE;
|
} DEHFILE;
|
||||||
|
|
||||||
// killough 10/98: emulate IO whether input really comes from a file or not
|
// 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)
|
||||||
if (*t == '=') break;
|
if (*t == '=') break;
|
||||||
buffer[i] = *t; // copy it
|
buffer[i] = *t; // copy it
|
||||||
}
|
}
|
||||||
|
if (i == 0) i = 1; /* Just in case */
|
||||||
buffer[--i] = '\0'; // terminate the key before the '='
|
buffer[--i] = '\0'; // terminate the key before the '='
|
||||||
if (!*t) // end of string with no equal sign
|
if (!*t) // end of string with no equal sign
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue