From dd1063fc2ccc5c254ee018398c0162cccd549018 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 10 Nov 2023 18:17:39 -0500 Subject: [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 --- firmware/common/pathfuncs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'firmware') 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'; -- cgit v1.2.3