ssh: Fix possible infinite loop in case of an read error.
authorWerner Koch <wk@gnupg.org>
Wed, 24 Oct 2018 18:11:33 +0000 (20:11 +0200)
committerWerner Koch <wk@gnupg.org>
Wed, 24 Oct 2018 18:11:33 +0000 (20:11 +0200)
* agent/command-ssh.c (ssh_handler_add_identity): Handle other errors
than EOF.
--

GnuPG-bug-id: 4221
Signed-off-by: Werner Koch <wk@gnupg.org>
agent/command-ssh.c

index ff1f0a5..86fd092 100644 (file)
@@ -3249,9 +3249,10 @@ ssh_handler_add_identity (ctrl_t ctrl, estream_t request, estream_t response)
   while (1)
     {
       err = stream_read_byte (request, &b);
   while (1)
     {
       err = stream_read_byte (request, &b);
-      if (gpg_err_code (err) == GPG_ERR_EOF)
-       {
-         err = 0;
+      if (err)
+        {
+          if (gpg_err_code (err) == GPG_ERR_EOF)
+            err = 0;
          break;
        }
 
          break;
        }