mirror of
https://github.com/lxsang/ant-http
synced 2024-11-17 17:08:20 +01:00
fix invalid read problem
This commit is contained in:
parent
88a85fb36a
commit
64b27c0dd3
@ -881,13 +881,15 @@ dictionary decode_url_request(const char* query)
|
||||
while ((token = strsep(&str_copy, "&")))
|
||||
{
|
||||
char* key;
|
||||
char* val;
|
||||
char* val = NULL;
|
||||
if(strlen(token)>0)
|
||||
{
|
||||
key = strsep(&token,"=");
|
||||
if(key && strlen(key)>0)
|
||||
{
|
||||
val = strsep(&token,"=");
|
||||
val = strsep(&token,"=");
|
||||
if(!val)
|
||||
val = "";
|
||||
dput(dic,key,url_decode(val));
|
||||
}
|
||||
}
|
||||
|
@ -249,6 +249,8 @@ int regex_match(const char* expr,const char* search, int msize, regmatch_t* matc
|
||||
return ret;
|
||||
}
|
||||
char *url_decode(const char *str) {
|
||||
if(!str)
|
||||
return NULL;
|
||||
char *pstr = str, *buf = malloc(strlen(str) + 1), *pbuf = buf;
|
||||
|
||||
while (*pstr) {
|
||||
|
Loading…
Reference in New Issue
Block a user