diff options
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/http.c b/lib/http.c index 95ba8d0db..dd12e964a 100644 --- a/lib/http.c +++ b/lib/http.c @@ -203,10 +203,9 @@ char *Curl_copy_header_value(const char *h) ++h; /* Find the first non-space letter */ - for(start=h; - *start && ISSPACE(*start); - start++) - ; /* empty loop */ + start = h; + while(*start && ISSPACE(*start)) + start++; /* data is in the host encoding so use '\r' and '\n' instead of 0x0d and 0x0a */ @@ -215,10 +214,12 @@ char *Curl_copy_header_value(const char *h) end = strchr(start, '\n'); if(!end) end = strchr(start, '\0'); + if(!end) + return NULL; /* skip all trailing space letters */ - for(; ISSPACE(*end) && (end > start); end--) - ; /* empty loop */ + while((end > start) && ISSPACE(*end)) + end--; /* get length of the type */ len = end-start+1; |