From fc445b36fafc8a4cc3ce5a675ac42df7a9d9a02a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 2 Sep 2016 15:33:34 +0200 Subject: [PATCH] common: Check read errors in name-value.c * common/name-value.c: Check for read errors. Signed-off-by: Werner Koch --- common/name-value.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)