forked from len0rd/rockbox
[BUGFIX] path_append_ex() component string
basepath_max is used to truncate basepath but was being applied to component as well in error Change-Id: I3557b8544923f97c980363fe6931b505c0bd9c07
This commit is contained in:
parent
7ac4d34dd6
commit
dd1063fc2c
1 changed files with 2 additions and 1 deletions
|
@ -476,6 +476,7 @@ size_t path_append_ex(char *buf, const char *basepath, size_t basepath_max,
|
||||||
/* 'component' is absolute; replace all */
|
/* 'component' is absolute; replace all */
|
||||||
basepath = component;
|
basepath = component;
|
||||||
component = "";
|
component = "";
|
||||||
|
basepath_max = -1u;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if basepath is not null or empty, buffer contents are replaced,
|
/* if basepath is not null or empty, buffer contents are replaced,
|
||||||
|
@ -486,7 +487,7 @@ size_t path_append_ex(char *buf, const char *basepath, size_t basepath_max,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = strlcpy(buf, basepath, bufsize);
|
len = strlcpy(buf, basepath, bufsize);
|
||||||
if (basepath_max < len && basepath != component)
|
if (basepath_max < len)
|
||||||
{
|
{
|
||||||
len = basepath_max;
|
len = basepath_max;
|
||||||
buf[basepath_max] = '\0';
|
buf[basepath_max] = '\0';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue