* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
***************************************************************************/
#include "tool_setup.h"
-#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
-#include <curl/mprintf.h>
-
+#define ENABLE_CURLX_PRINTF
+/* use our own printf() functions */
+#include "curlx.h"
+#include "tool_cfgable.h"
+#include "tool_doswin.h"
#include "tool_urlglob.h"
#include "tool_vms.h"
char *endp;
unsigned long lstep;
errno = 0;
- lstep = strtoul(&pattern[3], &endp, 10);
+ lstep = strtoul(&pattern[4], &endp, 10);
if(errno || (*endp != ']'))
step = -1;
else {
*posp += (pattern - *patternp);
if((rc != 2) || (min_c >= max_c) || ((max_c - min_c) > ('z' - 'a')) ||
- (step < 0) )
+ (step <= 0) )
/* the pattern is not well-formed */
return GLOBERROR("bad range", *posp, CURLE_URL_MALFORMAT);
pat->content.CharRange.max_c = max_c;
if(multiply(amount, (pat->content.CharRange.max_c -
- pat->content.CharRange.min_c + 1)))
+ pat->content.CharRange.min_c) /
+ pat->content.CharRange.step + 1) )
return GLOBERROR("range overflow", *posp, CURLE_URL_MALFORMAT);
}
else if(ISDIGIT(*pattern)) {
*posp += (pattern - *patternp);
- if(!endp || (min_n > max_n) || (step_n > (max_n - min_n)))
+ if(!endp || (min_n > max_n) || (step_n > (max_n - min_n)) || !step_n)
/* the pattern is not well-formed */
return GLOBERROR("bad range", *posp, CURLE_URL_MALFORMAT);
pat->content.NumRange.step = step_n;
if(multiply(amount, (pat->content.NumRange.max_n -
- pat->content.NumRange.min_n + 1)))
+ pat->content.NumRange.min_n) /
+ pat->content.NumRange.step + 1) )
return GLOBERROR("range overflow", *posp, CURLE_URL_MALFORMAT);
}
else
stringlen += appendlen;
}
target[stringlen]= '\0';
+
+#if defined(MSDOS) || defined(WIN32)
+ {
+ char *sanitized;
+ SANITIZEcode sc = sanitize_file_name(&sanitized, target,
+ (SANITIZE_ALLOW_PATH |
+ SANITIZE_ALLOW_RESERVED));
+ Curl_safefree(target);
+ if(sc)
+ return CURLE_URL_MALFORMAT;
+ target = sanitized;
+ }
+#endif /* MSDOS || WIN32 */
+
*result = target;
return CURLE_OK;
}
-