From: Ken Raeburn Date: Thu, 22 Jan 2009 06:30:08 +0000 (+0000) Subject: If USE_VALGRIND, check readability of byte string before copying X-Git-Tag: krb5-1.7-alpha1~55 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f;p=krb5.git 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 --- 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;