[Libpst-devel] _pst_read_block_size errors

Nigel Horne njh at bandsman.co.uk
Wed Apr 26 12:40:24 UTC 2006


In _pst_read_block_size if the number of bytes read is small (typically 0)
the software reads uninitialised values because it does things such as
read buf[0], even though no data has been read into it.

Here's the proposed fix:

*** Olibpst.c	Wed Apr 26 13:35:51 2006
--- libpst.c	Wed Apr 26 13:37:17 2006
***************
*** 3856,3861 ****
--- 3856,3866 ----
      } else {
        DEBUG_WARN(("I can't tell why it failed\n"));
      }
+ 	if(rsize <= 2) {
+ 		fseek(pf->fp, fpos, SEEK_SET);
+ 		*buf = '\0';
+ 		return 0;
+ 	}
      size = rsize;
    }

-Nigel Horne



More information about the Libpst-devel mailing list