File squid:boo_819982.patch of Package squid.openSUSE_13.1_Update

Index: squid-3.3.13/src/store_client.cc
===================================================================
--- squid-3.3.13.orig/src/store_client.cc
+++ squid-3.3.13/src/store_client.cc
@@ -568,15 +568,14 @@ storeClientReadBody(void *data, const ch
     sc->readBody(buf, len);
 }
 
-void
+bool
 store_client::unpackHeader(char const *buf, ssize_t len)
 {
     debugs(90, 3, "store_client::unpackHeader: len " << len << "");
 
     if (len < 0) {
         debugs(90, 3, "store_client::unpackHeader: " << xstrerror() << "");
-        fail();
-        return;
+        return false;
     }
 
     int swap_hdr_sz = 0;
@@ -585,16 +584,14 @@ store_client::unpackHeader(char const *b
     if (!aBuilder.isBufferSane()) {
         /* oops, bad disk file? */
         debugs(90, DBG_IMPORTANT, "WARNING: swapfile header inconsistent with available data");
-        fail();
-        return;
+        return false;
     }
 
     tlv *tlv_list = aBuilder.createStoreMeta ();
 
     if (tlv_list == NULL) {
         debugs(90, DBG_IMPORTANT, "WARNING: failed to unpack meta data");
-        fail();
-        return;
+        return false;
     }
 
     /*
@@ -603,8 +600,7 @@ store_client::unpackHeader(char const *b
     for (tlv *t = tlv_list; t; t = t->next) {
         if (!t->checkConsistency(entry)) {
             storeSwapTLVFree(tlv_list);
-            fail();
-            return;
+            return false;
         }
     }
 
@@ -618,6 +614,7 @@ store_client::unpackHeader(char const *b
     debugs(90, 5, "store_client::unpackHeader: swap_file_sz=" <<
            entry->swap_file_sz << "( " << swap_hdr_sz << " + " <<
            entry->mem_obj->object_sz << ")");
+    return true;
 }
 
 void
@@ -629,11 +626,15 @@ store_client::readHeader(char const *buf
     flags.disk_io_pending = 0;
     assert(_callback.pending());
 
-    unpackHeader (buf, len);
-
+    //abort if we fail()'d already
     if (!object_ok)
         return;
 
+    if (!unpackHeader(buf, len)) {
+      fail();
+      return;
+    }
+
     /*
      * If our last read got some data the client wants, then give
      * it to them, otherwise schedule another read.
Index: squid-3.3.13/src/StoreClient.h
===================================================================
--- squid-3.3.13.orig/src/StoreClient.h
+++ squid-3.3.13/src/StoreClient.h
@@ -103,7 +103,7 @@ private:
     void scheduleMemRead();
     void scheduleRead();
     void startSwapin();
-    void unpackHeader(char const *buf, ssize_t len);
+    bool unpackHeader(char const *buf, ssize_t len);
 
     int type;
     bool object_ok;
openSUSE Build Service is sponsored by