From: Daniel Stenberg Date: Thu, 6 Jan 2005 22:54:37 +0000 (+0000) Subject: prevent a single byte read outside the string in test case 39 X-Git-Tag: upstream/7.37.1~11679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a137223b4f99bafd94b8539944b748ebe5ef9cca;p=platform%2Fupstream%2Fcurl.git prevent a single byte read outside the string in test case 39 --- diff --git a/src/main.c b/src/main.c index a001778..ad3a5f4 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];