json: Fix crash on invalid json
* src/gpgme-json.c (process_request): Init res. Check for json object before encode and chunk. -- If json is invalid we can't read chunksize and would crash in encode and chunk.
This commit is contained in:
parent
cc21101a74
commit
1686e07e77
@ -3104,7 +3104,7 @@ process_request (const char *request)
|
||||
int helpmode;
|
||||
int is_getmore = 0;
|
||||
const char *op;
|
||||
char *res;
|
||||
char *res = NULL;
|
||||
int idx;
|
||||
|
||||
response = xjson_CreateObject ();
|
||||
@ -3188,7 +3188,7 @@ process_request (const char *request)
|
||||
else
|
||||
res = cJSON_PrintUnformatted (response);
|
||||
}
|
||||
else
|
||||
else if (json)
|
||||
res = encode_and_chunk (json, response);
|
||||
if (!res)
|
||||
log_error ("Printing JSON data failed\n");
|
||||
|
Loading…
Reference in New Issue
Block a user