Skip to content
Snippets Groups Projects
Commit d572d266 authored by Jay Satiro's avatar Jay Satiro
Browse files

tool_operhlp: Check for backslashes in get_url_file_name

Extract the filename from the last slash or backslash. Prior to this
change backslashes could be part of the filename.

This change needed for the curl tool built for Cygwin. Refer to the
CYGWIN addendum in advisory 20160127B.

Bug: https://curl.haxx.se/docs/adv_20160127B.html
parent b9730704
No related branches found
No related tags found
No related merge requests found
......@@ -129,7 +129,7 @@ char *add_file_name_to_url(CURL *curl, char *url, const char *filename)
*/
CURLcode get_url_file_name(char **filename, const char *url)
{
const char *pc;
const char *pc, *pc2;
*filename = NULL;
......@@ -139,7 +139,11 @@ CURLcode get_url_file_name(char **filename, const char *url)
pc += 3;
else
pc = url;
pc2 = strrchr(pc, '\\');
pc = strrchr(pc, '/');
if(pc2 && (!pc || pc < pc2))
pc = pc2;
if(pc)
/* duplicate the string beyond the slash */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment