[Pkg-gnupg-commit] [gnupg2] 54/118: common: Check read errors in name-value.c

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 15 18:25:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.

commit fc445b36fafc8a4cc3ce5a675ac42df7a9d9a02a
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Sep 2 15:33:34 2016 +0200

    common: Check read errors in name-value.c
    
    * common/name-value.c: Check for read errors.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 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 0b32a44..ebc48e5 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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list