diff options
author | Ken Raeburn <raeburn@mit.edu> | 2009-01-22 06:30:08 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2009-01-22 06:30:08 +0000 |
commit | 6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f (patch) | |
tree | e8c815579f3e2461e03716fc6b97195681bc45de /src/lib/krb5/asn.1/asn1buf.c | |
parent | 9d5c0a06c8803cba04c3aba79d1008119086349e (diff) | |
download | krb5-6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f.tar.gz krb5-6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f.tar.xz krb5-6adbcd8d205f254ace5dd2cf66e0e6cdae4a407f.zip |
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
Diffstat (limited to 'src/lib/krb5/asn.1/asn1buf.c')
-rw-r--r-- | src/lib/krb5/asn.1/asn1buf.c | 7 |
1 files changed, 7 insertions, 0 deletions
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 <stdio.h> #include "asn1_get.h" +#ifdef USE_VALGRIND +#include <valgrind/memcheck.h> +#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; |