From 6f625101d2eeaa7afd445f9685d53c39e9f7246a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 17 Apr 2007 17:47:42 +0000 Subject: [PATCH] Try to be more correct and don't fall off the end. Pointed out by Kevin Coffman. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20372 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/asn1/der_get.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/asn1/der_get.c b/lib/asn1/der_get.c index 1f9b5d72d..00efa76c1 100644 --- a/lib/asn1/der_get.c +++ b/lib/asn1/der_get.c @@ -145,10 +145,9 @@ der_get_general_string (const unsigned char *p, size_t len, * an strings in the NEED_PREAUTH case that includes a * trailing NUL. */ - len = p1 - p; - while (*p1 == '\0' && p1 - p < len) + while (p1 - p < len && *p1 == '\0') p1++; - if (p1 - p != len + 1) + if (p1 - p != len) return ASN1_BAD_CHARACTER; } if (len > len + 1)