]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #1703 unable to bextract compressed files
authorKern Sibbald <kern@sibbald.com>
Mon, 7 Mar 2011 16:01:25 +0000 (17:01 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:40 +0000 (14:43 +0200)
bacula/src/stored/bextract.c

index fde9a99b26211693aced54543d777a6617ed7701..ca65673e6c62a94ea3da95889f1aaf4133db2ced 100644 (file)
@@ -410,7 +410,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
    case STREAM_WIN32_GZIP_DATA:
 #ifdef HAVE_LIBZ
       if (extract) {
-         uLong compress_len;
+         uLong compress_len = compress_buf_size;
          int stat;
 
          if (rec->maskedStream == STREAM_SPARSE_GZIP_DATA) {
@@ -436,11 +436,10 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
             wsize = rec->data_len;
          }
 
-         while ((stat=uncompress((Byte *)compress_buf, &compress_len,
-                                 (const Byte *)wbuf, (uLong)wsize)) == Z_BUF_ERROR)
-         {
+         while (compress_len < 10000000 && (stat=uncompress((Byte *)compress_buf, &compress_len,
+                                 (const Byte *)wbuf, (uLong)wsize)) == Z_BUF_ERROR) {
             /* The buffer size is too small, try with a bigger one */
-            compress_len = compress_len + (compress_len >> 1);
+            compress_len = 2 * compress_len;
             compress_buf = check_pool_memory_size(compress_buf,
                                                   compress_len);
          }