Avoid creating an illegal pointer

Found by tis-interpreter

Reviewed-by: Rich Salz <rsalz@openssl.org>

GH: #1164
This commit is contained in:
Kurt Roeckx 2016-06-04 16:25:39 +02:00
parent 5000a6d121
commit 3892b95750

View File

@ -396,10 +396,10 @@ static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in)
len--;
}
to = from + len - 1;
to = from + len;
/* Ignore trailing spaces */
while ((len > 0) && !(*to & 0x80) && isspace(*to)) {
while ((len > 0) && !(to[-1] & 0x80) && isspace(to[-1])) {
to--;
len--;
}