mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
[BugFix] pathfuncs.c path_append_ex basepath_max might cause buffer ovfl
strlcpy returns the length of the string that would have been copied had there been sufficient space basepath_max might still be larger than buf_size yet smaller than len which would result in a null terminator being written past buf[buf_size-1] Change-Id: I43e8ba9f72ea35bfe4f759ecd102c2e4bd26eb75
This commit is contained in:
parent
27aff7ec8d
commit
186ad1234b
1 changed files with 1 additions and 1 deletions
|
@ -570,7 +570,7 @@ size_t path_append_ex(char *buf, const char *basepath, size_t basepath_max,
|
||||||
if (basepath_max < len) /*if needed truncate basepath to basepath_max */
|
if (basepath_max < len) /*if needed truncate basepath to basepath_max */
|
||||||
{
|
{
|
||||||
len = basepath_max;
|
len = basepath_max;
|
||||||
buf[basepath_max] = '\0';
|
buf[MIN(bufsize - 1, basepath_max)] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue