Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl_dedotdotify(): always nul terminate returned string. #3039

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/dotdot.c
Expand Up @@ -62,6 +62,8 @@ char *Curl_dedotdotify(const char *input)
if(!out)
return NULL; /* out of memory */

*out = 0; /* zero terminates, for inputs like "./" */

/* get a cloned copy of the input */
clone = strdup(input);
if(!clone) {
Expand Down
3 changes: 3 additions & 0 deletions tests/libtest/lib1560.c
Expand Up @@ -300,6 +300,9 @@ static struct urltestcase get_url_list[] = {
{"file:///file.txt",
"file:///file.txt",
0, 0, CURLUE_OK},
{"file:./",
"file://",
0, 0, CURLUE_MALFORMED_INPUT},
{"http://example.com/hello/../here",
"http://example.com/hello/../here",
CURLU_PATH_AS_IS, 0, CURLUE_OK},
Expand Down