Fix potential buffer overflow.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27568 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a3e6a865df
commit
f69e995bda
1 changed files with 2 additions and 2 deletions
|
@ -1211,13 +1211,13 @@ void set_file(const char* filename, char* setting, const int maxlen)
|
|||
else
|
||||
extlen = strlen(extptr);
|
||||
|
||||
len = strlen(fptr) - extlen;
|
||||
len = strlen(fptr) - extlen + 1;
|
||||
|
||||
/* error if filename isn't in ROCKBOX_DIR */
|
||||
if (strncasecmp(ROCKBOX_DIR, filename, ROCKBOX_DIR_LEN) || (len > maxlen))
|
||||
return;
|
||||
|
||||
strlcpy(setting, fptr, len+1);
|
||||
strlcpy(setting, fptr, len);
|
||||
settings_save();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue