disable the pre-allocation check in ytnef to actually make it usable with

large winmail.dat files
This commit is contained in:
robert 2019-11-07 10:33:52 +00:00
parent 43e4adbd1f
commit e5418f671d
2 changed files with 19 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.4 2019/07/12 20:43:49 sthen Exp $
# $OpenBSD: Makefile,v 1.5 2019/11/07 10:33:52 robert Exp $
COMMENT= read and convert TNEF files
SHARED_LIBS += ytnef 0.0 # 0.0
DISTNAME= libytnef-1.9.3
REVISION= 0
GH_ACCOUNT= Yeraze
GH_PROJECT= ytnef

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-lib_ytnef_c,v 1.1 2019/11/07 10:33:52 robert Exp $
this allocation check is just useless especially with big winmail.dat files
so disable it to actually make the software usable
Index: lib/ytnef.c
--- lib/ytnef.c.orig
+++ lib/ytnef.c
@@ -55,7 +55,7 @@
#define MIN(x,y) (((x)<(y))?(x):(y))
-#define PREALLOCCHECK(sz,max) { if(sz==0||(unsigned)sz>max) { printf("ERROR: invalid alloc size %u at %s : %i, suspected corruption (exceeded %i bytes)\n", (unsigned)sz, __FILE__, __LINE__, max); return(-1); } }
+#define PREALLOCCHECK(sz,max)
#define ALLOCCHECK(x) { if(!x) { printf("Out of Memory at %s : %i\n", __FILE__, __LINE__); return(-1); } }
#define ALLOCCHECK_CHAR(x) { if(!x) { printf("Out of Memory at %s : %i\n", __FILE__, __LINE__); return(NULL); } }
#define SIZECHECK(x) { if ((((char *)d - (char *)data) + x) > size) { printf("Corrupted file detected at %s : %i\n", __FILE__, __LINE__); return(-1); } }