The `fl_path_canonical()` is replacing the `canonical` variable rather than appending to it.
However, when `path.used` is 0, then the current path is appended without resetting `canonical.used` to 0.
Ensure that `canonical.used` is always set to 0 to enforce replacement.
Add explicit documentation comment making it clear that this function performs a replacement rather than an append.
f_status_t status = F_okay;
+ canonical->used = 0;
+
if (!path.used) {
status = f_path_current(F_true, canonical);
if (F_status_is_error(status)) return status;
f_number_unsigned_t size_chunk = 0;
f_number_unsigned_t position = 0;
- canonical->used = 0;
-
while (at < path.used && !path.string[at]) ++at;
if (path.string[at] == f_path_separator_s.string[0]) {
* This need not be NULL terminated.
* @param canonical
* The (allocated) canonical file path.
+ * This parameter is overwritten rather than being appended to.
* This will be NULL terminated at canonical->used + 1.
*
* @return
.TP
.B canonical
-The (allocated) canonical file path. This will be NULL terminated at canonical->used + 1.
+The (allocated) canonical file path. This parameter is overwritten rather than being appended to. This will be NULL terminated at canonical->used + 1.
.SH STRUCTURES
.SS ""