diff options
author | Rich Salz <rsalz@openssl.org> | 2017-06-14 20:34:37 -0400 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-07-05 11:32:35 +1000 |
commit | 0904e79a6e6109240d5a552f2699408b26cf63ee (patch) | |
tree | df0b4928a751b05779164cf7dd84265407bea332 /crypto/asn1/x_long.c | |
parent | ff281ee8369350d88e8b57af139614f5683e1e8c (diff) |
Undo commit d420ac2
[extended tests]
Original text:
Use BUF_strlcpy() instead of strcpy().
Use BUF_strlcat() instead of strcat().
Use BIO_snprintf() instead of sprintf().
In some cases, keep better track of buffer lengths.
This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3701)
Diffstat (limited to 'crypto/asn1/x_long.c')
-rw-r--r-- | crypto/asn1/x_long.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index 4bb66114ba..78f4b764c3 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -89,12 +89,8 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, long ltmp; unsigned long utmp, sign; int clen, pad, i; - /* this exists to bypass broken gcc optimization */ - char *cp = (char *)pval; - - /* use memcpy, because we may not be long aligned */ - memcpy(<mp, cp, sizeof(long)); + ltmp = *(long *)pval; if (ltmp == it->size) return -1; /* @@ -136,7 +132,6 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int i; long ltmp; unsigned long utmp = 0, sign = 0x100; - char *cp = (char *)pval; if (len > 1) { /* @@ -188,7 +183,7 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); return 0; } - memcpy(cp, <mp, sizeof(long)); + *(long*)pval = ltmp; return 1; } |