if StrBuf_ServGetln() is called in a loop, its return value has to be checked for...
[citadel.git] / webcit / tcp_sockets.c
index b7ab06ba7cdf9a6ef0edddac5ea40d2a93e1c9a2..f03e003016df5b1fe935d3f07a0c8ff014a65b8a 100644 (file)
@@ -404,7 +404,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);