aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-04-22 09:31:27 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-04-22 09:31:27 +0000
commita93af43974c02c675443e285fa9d9710b2f0a7c9 (patch)
tree7224b30b15ad90cc9335d7b43682bee126eccf2c /src
parent0bbc759c0c95c8b43571a5c5eb72f6d7719a0569 (diff)
- Song Ma's warning if -r/--range is given with a "bad" range, also noted in
the man page now.
Diffstat (limited to 'src')
-rw-r--r--src/main.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 55d1d0adf..229eb8dc8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2350,7 +2350,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
(and won't actually be range by definition). The man page previously
claimed that to be a good way, why this code is added to work-around
it. */
- if(!strchr(nextarg, '-')) {
+ if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
char buffer[32];
curl_off_t off;
warnf(config,
@@ -2360,10 +2360,23 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
snprintf(buffer, sizeof(buffer), "%Od-", off);
GetStr(&config->range, buffer);
}
- else
+ {
+ /* byte range requested */
+ char* tmp_range;
+ tmp_range=nextarg;
+ while(*tmp_range != '\0') {
+ if(!ISDIGIT(*tmp_range)&&*tmp_range!='-'&&*tmp_range!=',') {
+ warnf(config,"Invalid character is found in given range. "
+ "A specified range MUST have only digits in "
+ "\'start\'-\'stop\'. The server's response to this "
+ "request is uncertain.\n");
+ break;
+ }
+ tmp_range++;
+ }
/* byte range requested */
GetStr(&config->range, nextarg);
-
+ }
break;
case 'R':
/* use remote file's time */