freebsd-ports/security/trousers/files/patch-src-include-tcs_utils.h
Norikatsu Shigemura 7612f38ced Add trousers 0.3.6, is a CPL (Common Public License) licensed Trusted
Computing Software Stack.  It is mostly compliant with the TSS 1.2
specification.

Obtained from:	http://bsssd.sourceforge.net/
2010-11-07 12:05:27 +00:00

23 lines
538 B
C

--- src/include/tcs_utils.h.orig 2010-01-29 01:27:51.000000000 +0900
+++ src/include/tcs_utils.h 2010-10-24 21:04:04.824555399 +0900
@@ -18,6 +18,20 @@
#include "tcs_tsp.h"
#include "trousers_types.h"
+
+
+/*
+ * XXX malloc wrapper
+ *
+ * Linux: malloc(0) => '\0'
+ * *BSD: malloc(0) => invalid to dereference
+ *
+ * => so wrap malloc(0) => calloc(1, 16) to create
+ * a 16Byte array containing '\0'
+ *
+ */
+#define malloc(x) ((x) == 0 ? calloc(1, 16) : calloc(1, (x)))
+
struct key_mem_cache
{
TCPA_KEY_HANDLE tpm_handle;