diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-01-06 22:54:37 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-01-06 22:54:37 +0000 |
commit | a137223b4f99bafd94b8539944b748ebe5ef9cca (patch) | |
tree | 7637696e7dd9e5cab95875bdb5fa33c38790ea45 | |
parent | 52e1ce95189dfe2c79167a9b0c284e3d966f95e0 (diff) |
prevent a single byte read outside the string in test case 39
-rw-r--r-- | src/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c index a001778dd..ad3a5f4cd 100644 --- a/src/main.c +++ b/src/main.c @@ -863,7 +863,6 @@ static int formparse(char *input, ptr++; if(curlx_strnequal("type=", ptr, 5)) { - /* set type pointer */ type = &ptr[5]; @@ -878,9 +877,13 @@ static int formparse(char *input, /* now point beyond the content-type specifier */ sep = (char *)type + strlen(major)+strlen(minor)+1; - *sep=0; /* zero terminate type string */ + if(*sep) { + *sep=0; /* zero terminate type string */ - ptr=sep+1; + ptr=sep+1; + } + else + ptr = NULL; /* end */ } else if(curlx_strnequal("filename=", ptr, 9)) { filename = &ptr[9]; |