Auth: handle socket read errors in Dovecot authenticator
authorBruce Lee <straightblast426@gmail.com>
Tue, 30 Jul 2019 21:43:14 +0000 (22:43 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Fri, 2 Aug 2019 12:27:42 +0000 (13:27 +0100)
src/src/auths/dovecot.c

index 9c0c9b3133d261c95b4e4c3a595fced220da09d2..4628863e0cc09714f7cec16024d21b6989e595a0 100644 (file)
@@ -215,8 +215,8 @@ for (;;)
   {
   if (socket_buffer_left == 0)
     {
-    socket_buffer_left = read(fd, sbuffer, sizeof(sbuffer));
-    if (socket_buffer_left == 0) { if (count == 0) return NULL; else break; }
+    if ((socket_buffer_left = read(fd, sbuffer, sizeof(sbuffer))) <= 0)
+      if (count == 0) return NULL; else break;
     p = 0;
     }