if StrBuf_ServGetln() is called in a loop, its return value has to be checked for...
[citadel.git] / webcit / tcp_sockets.c
index e783feb7fca0ca5f9643b581a92bee5d1ad0c381..6bbef24fb5fb7459fb001af957229c48bb3a6757 100644 (file)
@@ -333,7 +333,10 @@ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf)
                }
 
                serv_printf("READ %d|%d", bytes_read, total_len-bytes_read);
-               if ( (StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) ) {
+               if ( (rc = StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) ) 
+               {
+                       if (rc < 0)
+                               return rc;
                        StrBufCutLeft(Buf, 4);
                        this_block = StrTol(Buf);
                        rc = StrBuf_ServGetBLOBBuffered(Ret, this_block);