Fossil SCM

Fix a (harmless) buffer size miscalculation in the decompression logic.

drh 2010-12-23 17:53 trunk
Commit 52aa366c18eda9946c483e4bf2152ce51cdcd94e
1 file changed +1 -1
+1 -1
--- src/blob.c
+++ src/blob.c
@@ -826,11 +826,11 @@
826826
nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
827827
blob_zero(&temp);
828828
blob_resize(&temp, nOut+1);
829829
nOut2 = (long int)nOut;
830830
rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
831
- &inBuf[4], blob_size(pIn));
831
+ &inBuf[4], nIn - 4);
832832
if( rc!=Z_OK ){
833833
blob_reset(&temp);
834834
return 1;
835835
}
836836
blob_resize(&temp, nOut2);
837837
--- src/blob.c
+++ src/blob.c
@@ -826,11 +826,11 @@
826 nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
827 blob_zero(&temp);
828 blob_resize(&temp, nOut+1);
829 nOut2 = (long int)nOut;
830 rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
831 &inBuf[4], blob_size(pIn));
832 if( rc!=Z_OK ){
833 blob_reset(&temp);
834 return 1;
835 }
836 blob_resize(&temp, nOut2);
837
--- src/blob.c
+++ src/blob.c
@@ -826,11 +826,11 @@
826 nOut = (inBuf[0]<<24) + (inBuf[1]<<16) + (inBuf[2]<<8) + inBuf[3];
827 blob_zero(&temp);
828 blob_resize(&temp, nOut+1);
829 nOut2 = (long int)nOut;
830 rc = uncompress((unsigned char*)blob_buffer(&temp), &nOut2,
831 &inBuf[4], nIn - 4);
832 if( rc!=Z_OK ){
833 blob_reset(&temp);
834 return 1;
835 }
836 blob_resize(&temp, nOut2);
837

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button