diff options
author | William Wilgus <wilgus.william@gmail.com> | 2023-11-10 18:17:39 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2023-11-10 18:17:39 -0500 |
commit | dd1063fc2ccc5c254ee018398c0162cccd549018 (patch) | |
tree | d8622e490565afb3e541afbc4ce3f044b7f66f99 /firmware | |
parent | 7ac4d34dd61547db97712dc608c9eb19c9a42e3c (diff) | |
download | rockbox-dd1063fc2ccc5c254ee018398c0162cccd549018.tar.gz rockbox-dd1063fc2ccc5c254ee018398c0162cccd549018.zip |
[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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/pathfuncs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/firmware/common/pathfuncs.c b/firmware/common/pathfuncs.c index 6b70078eb1..ff3de7b616 100644 --- a/firmware/common/pathfuncs.c +++ b/firmware/common/pathfuncs.c | |||
@@ -476,6 +476,7 @@ size_t path_append_ex(char *buf, const char *basepath, size_t basepath_max, | |||
476 | /* 'component' is absolute; replace all */ | 476 | /* 'component' is absolute; replace all */ |
477 | basepath = component; | 477 | basepath = component; |
478 | component = ""; | 478 | component = ""; |
479 | basepath_max = -1u; | ||
479 | } | 480 | } |
480 | 481 | ||
481 | /* if basepath is not null or empty, buffer contents are replaced, | 482 | /* 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, | |||
486 | else | 487 | else |
487 | { | 488 | { |
488 | len = strlcpy(buf, basepath, bufsize); | 489 | len = strlcpy(buf, basepath, bufsize); |
489 | if (basepath_max < len && basepath != component) | 490 | if (basepath_max < len) |
490 | { | 491 | { |
491 | len = basepath_max; | 492 | len = basepath_max; |
492 | buf[basepath_max] = '\0'; | 493 | buf[basepath_max] = '\0'; |