diff options
author | David Benjamin <davidben@google.com> | 2016-06-12 02:12:10 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2016-06-14 00:57:05 +0300 |
commit | d0c677cd8e2fca7fce5d77090f3616ba1d59e0c9 (patch) | |
tree | cd168c19a2c5e9f3fad17f71037ae9d09ebfac4d /crypto/x509 | |
parent | 37e01b393cd4c4d2f8b2b48fe9b2a94907a495a9 (diff) |
Avoid illegal pointers in asn1_string_canon.
(Imported from upstream's 3892b95750b6aa5ed4328a287068f7cdfb9e55bc.)
More reasonable would have been to drop |to| altogether and act on from[len-1],
but I suppose this works.
Change-Id: I280b4991042b4d330ba034f6a631f8421ddb2643
Reviewed-on: https://boringssl-review.googlesource.com/8241
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x_name.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c index 9972843d..acefc090 100644 --- a/crypto/x509/x_name.c +++ b/crypto/x509/x_name.c @@ -464,10 +464,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--; } |