Fix use-after-free in path-to-filename function
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 8s

This commit is contained in:
Stephen Seo 2024-09-23 15:10:39 +09:00
parent abc61a5504
commit 7cc0d624be

View file

@ -77,7 +77,10 @@ char *c_simple_http_path_to_cache_filename(const char *path) {
}
if (prev_idx == 0) {
return stripped_path;
// Prevent string from being free'd by moving it to another variable.
char *temp = stripped_path;
stripped_path = NULL;
return temp;
} else {
return c_simple_http_combine_string_parts(parts);
}