svn rev #21774: trunk/src/lib/krb5/asn.1/

raeburn@MIT.EDU raeburn at MIT.EDU
Thu Jan 22 01:30:10 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21774
Commit By: raeburn
Log Message:
If USE_VALGRIND, check readability of byte string before copying.


Changed Files:
U   trunk/src/lib/krb5/asn.1/asn1buf.c
Modified: trunk/src/lib/krb5/asn.1/asn1buf.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1buf.c	2009-01-22 06:04:10 UTC (rev 21773)
+++ trunk/src/lib/krb5/asn.1/asn1buf.c	2009-01-22 06:30:08 UTC (rev 21774)
@@ -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 @@
 
     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;




More information about the cvs-krb5 mailing list