common: Check read errors in name-value.c

* common/name-value.c: Check for read errors.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-09-02 15:33:34 +02:00
parent 8fe8105576
commit fc445b36fa
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 6 additions and 1 deletions

View File

@ -665,7 +665,7 @@ do_nvc_parse (nvc_t *result, int *errlinep, estream_t stream,
if (errlinep)
*errlinep = 0;
while ((len = es_read_line (stream, &buf, &buf_len, NULL)))
while ((len = es_read_line (stream, &buf, &buf_len, NULL)) > 0)
{
char *p;
if (errlinep)
@ -735,6 +735,11 @@ do_nvc_parse (nvc_t *result, int *errlinep, estream_t stream,
goto leave;
}
}
if (len < 0)
{
err = gpg_error_from_syserror ();
goto leave;
}
/* Add the final entry. */
if (raw_value)