json: Ensure that native msging request is string
* src/gpgme-json.c (native_messaging_repl): Ensure that the request is NULL terminated. -- This avoids potential memory leaks and access to unmapped memory in case the request was not terminated. Other request functions use es_read_line which gurantees NULL termination.
This commit is contained in:
parent
82e4b900a9
commit
6d7b4382c3
@ -3601,7 +3601,7 @@ native_messaging_repl (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read request. */
|
/* Read request. */
|
||||||
request = xtrymalloc (nrequest);
|
request = xtrymalloc (nrequest + 1);
|
||||||
if (!request)
|
if (!request)
|
||||||
{
|
{
|
||||||
err = gpg_error_from_syserror ();
|
err = gpg_error_from_syserror ();
|
||||||
@ -3626,6 +3626,7 @@ native_messaging_repl (void)
|
|||||||
}
|
}
|
||||||
else /* Process request */
|
else /* Process request */
|
||||||
{
|
{
|
||||||
|
request[n] = '\0'; /* Esnure that request has an end */
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
log_debug ("request='%s'\n", request);
|
log_debug ("request='%s'\n", request);
|
||||||
xfree (response);
|
xfree (response);
|
||||||
|
Loading…
Reference in New Issue
Block a user