[Libpst-commits] r59 - trunk
Joseph Nahmias
jello at alioth.debian.org
Thu Dec 7 17:51:25 CET 2006
Author: jello
Date: 2006-12-07 17:51:24 +0100 (Thu, 07 Dec 2006)
New Revision: 59
Modified:
trunk/libpst.c
Log:
pst_attach_to_file_base64(): don't call pst_fwrite() when base64_encode() returns NULL, closes tracker patch #303566.
Thanks to James Woodcock for the patch.
Modified: trunk/libpst.c
===================================================================
--- trunk/libpst.c 2006-12-07 16:41:47 UTC (rev 58)
+++ trunk/libpst.c 2006-12-07 16:51:24 UTC (rev 59)
@@ -296,7 +296,7 @@
size = _pst_ff_getID2data(pf, ptr, &h);
// will need to encode any bytes left over
c = base64_encode(h.base64_extra_chars, h.base64_extra);
- pst_fwrite(c, 1, strlen(c), fp);
+ if (c) pst_fwrite(c, 1, strlen(c), fp);
} else {
DEBUG_WARN (("Couldn't find ID pointer. Cannot save attachement to Base64\n"));
}
@@ -3867,10 +3867,10 @@
fseek(pf->fp, offset, SEEK_SET);
if (*buf != NULL) {
DEBUG_READ(("Freeing old memory\n"));
- free(*buf);
+ free(*buf); *buf = NULL;
}
- *buf = (void*) xmalloc(size+1); //plus one so that we can NULL terminate it later
+ *buf = (void*) xmalloc(size+1); //plus one so that we can NUL terminate it later
rsize = fread(*buf, 1, size, pf->fp);
if (rsize != size) {
DEBUG_WARN(("Didn't read all that I could. fread returned less [%i instead of %i]\n", rsize, size));
More information about the Libpst-commits
mailing list