aboutsummaryrefslogtreecommitdiffstats
path: root/common/name-value.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-09-02 13:33:34 +0000
committerWerner Koch <[email protected]>2016-09-02 14:56:04 +0000
commitfc445b36fafc8a4cc3ce5a675ac42df7a9d9a02a (patch)
treebf99f23e3f6932364b28415cb0113a281bb62e69 /common/name-value.c
parentscd: Release the card reader after card removal. (diff)
downloadgnupg-fc445b36fafc8a4cc3ce5a675ac42df7a9d9a02a.tar.gz
gnupg-fc445b36fafc8a4cc3ce5a675ac42df7a9d9a02a.zip
common: Check read errors in name-value.c
* common/name-value.c: Check for read errors. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/name-value.c')
-rw-r--r--common/name-value.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/name-value.c b/common/name-value.c
index 0b32a4442..ebc48e513 100644
--- a/common/name-value.c
+++ b/common/name-value.c
@@ -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)