From 6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 22 Jan 2009 06:30:08 +0000 Subject: [PATCH] If USE_VALGRIND, check readability of byte string before copying git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21774 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/asn.1/asn1buf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c index b8efabaca..71ad03b24 100644 --- a/src/lib/krb5/asn.1/asn1buf.c +++ b/src/lib/krb5/asn.1/asn1buf.c @@ -55,6 +55,12 @@ #include #include "asn1_get.h" +#ifdef USE_VALGRIND +#include +#else +#define VALGRIND_CHECK_READABLE(PTR,SIZE) ((void)0) +#endif + #if !defined(__GNUC__) || defined(CONFIG_SMALL) /* Declare private procedures as static if they're not used for inline expansion of other stuff elsewhere. */ @@ -181,6 +187,7 @@ asn1buf_insert_bytestring(asn1buf *buf, const unsigned int len, const void *sv) retval = asn1buf_ensure_space(buf,len); if (retval) return retval; + VALGRIND_CHECK_READABLE(sv, len); for (length=1; length<=len; length++,(buf->next)++) *(buf->next) = (s[len-length]); return 0; -- 2.26.2