Loading src/tool_dirhie.c +12 −3 Original line number Diff line number Diff line Loading @@ -91,6 +91,14 @@ static void show_dir_errno(FILE *errors, const char *name) * should create all the dir* automagically */ #ifdef WIN32 /* systems that may use either or when specifying a path */ #define PATH_DELIMITERS "\\/" #else #define PATH_DELIMITERS DIR_CHAR #endif CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) { char *tempdir; Loading @@ -114,10 +122,10 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) /* Allow strtok() here since this isn't used threaded */ /* !checksrc! disable BANNEDFUNC 2 */ tempdir = strtok(outdup, DIR_CHAR); tempdir = strtok(outdup, PATH_DELIMITERS); while(tempdir != NULL) { tempdir2 = strtok(NULL, DIR_CHAR); tempdir2 = strtok(NULL, PATH_DELIMITERS); /* since strtok returns a token for the last word even if not ending with DIR_CHAR, we need to prune it */ if(tempdir2 != NULL) { Loading @@ -125,7 +133,8 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) if(dlen) snprintf(&dirbuildup[dlen], outlen - dlen, "%s%s", DIR_CHAR, tempdir); else { if(0 != strncmp(outdup, DIR_CHAR, 1)) if(outdup == tempdir) /* the output string doesn't start with a separator */ strcpy(dirbuildup, tempdir); else snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir); Loading Loading
src/tool_dirhie.c +12 −3 Original line number Diff line number Diff line Loading @@ -91,6 +91,14 @@ static void show_dir_errno(FILE *errors, const char *name) * should create all the dir* automagically */ #ifdef WIN32 /* systems that may use either or when specifying a path */ #define PATH_DELIMITERS "\\/" #else #define PATH_DELIMITERS DIR_CHAR #endif CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) { char *tempdir; Loading @@ -114,10 +122,10 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) /* Allow strtok() here since this isn't used threaded */ /* !checksrc! disable BANNEDFUNC 2 */ tempdir = strtok(outdup, DIR_CHAR); tempdir = strtok(outdup, PATH_DELIMITERS); while(tempdir != NULL) { tempdir2 = strtok(NULL, DIR_CHAR); tempdir2 = strtok(NULL, PATH_DELIMITERS); /* since strtok returns a token for the last word even if not ending with DIR_CHAR, we need to prune it */ if(tempdir2 != NULL) { Loading @@ -125,7 +133,8 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors) if(dlen) snprintf(&dirbuildup[dlen], outlen - dlen, "%s%s", DIR_CHAR, tempdir); else { if(0 != strncmp(outdup, DIR_CHAR, 1)) if(outdup == tempdir) /* the output string doesn't start with a separator */ strcpy(dirbuildup, tempdir); else snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir); Loading