Avoid typecasting a signed char to an int when using is*() functions, as that
could very well cause a negate number get passed in and thus cause reading outside of the array usually used for this purpose. We avoid this by using the uppercase macro versions introduced just now that does some extra crazy typecasts to avoid byte codes > 127 to cause negative int values.
This commit is contained in:
		| @@ -116,10 +116,6 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength) | ||||
|   return ns; | ||||
| } | ||||
|  | ||||
| #define ishex(in) ((in >= 'a' && in <= 'f') || \ | ||||
|                    (in >= 'A' && in <= 'F') || \ | ||||
|                    (in >= '0' && in <= '9')) | ||||
|  | ||||
| char *curl_easy_unescape(CURL *handle, const char *string, int length, | ||||
|                          int *olen) | ||||
| { | ||||
| @@ -138,7 +134,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length, | ||||
|  | ||||
|   while(--alloc > 0) { | ||||
|     in = *string; | ||||
|     if(('%' == in) && ishex(string[1]) && ishex(string[2])) { | ||||
|     if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { | ||||
|       /* this is two hexadecimal digits following a '%' */ | ||||
|       char hexstr[3]; | ||||
|       char *ptr; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Stenberg
					Daniel Stenberg