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 | |
parent | 7ac4d34dd61547db97712dc608c9eb19c9a42e3c (diff) | |
download | rockbox-dd1063fc2c.tar.gz rockbox-dd1063fc2c.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
-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, /* 'component' is absolute; replace all */ basepath = component; component = ""; + basepath_max = -1u; } /* 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 { len = strlcpy(buf, basepath, bufsize); - if (basepath_max < len && basepath != component) + if (basepath_max < len) { len = basepath_max; buf[basepath_max] = '\0'; |