diff options
author | 2014-05-18 19:30:36 +0000 | |
---|---|---|
committer | 2014-05-18 19:30:36 +0000 | |
commit | f4feb42a2d400d74d2bb069505de172c22ccab1f (patch) | |
tree | f2428e438433b7248c7e00e9a2afd7292f349bd5 | |
parent | use reallocarray (diff) | |
download | wireguard-openbsd-f4feb42a2d400d74d2bb069505de172c22ccab1f.tar.xz wireguard-openbsd-f4feb42a2d400d74d2bb069505de172c22ccab1f.zip |
Make sure UTF8_getc() is invoked with the proper buffer size.
ok beck@ guenther@
-rw-r--r-- | lib/libcrypto/asn1/a_strex.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/a_strex.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/libcrypto/asn1/a_strex.c b/lib/libcrypto/asn1/a_strex.c index 248eac28f6a..462a4059bec 100644 --- a/lib/libcrypto/asn1/a_strex.c +++ b/lib/libcrypto/asn1/a_strex.c @@ -111,7 +111,7 @@ send_fp_chars(void *arg, const void *buf, int len) { if (!arg) return 1; - if (fwrite(buf, 1, len, arg) != (unsigned int)len) + if (fwrite(buf, 1, (size_t)len, arg) != (size_t)len) return 0; return 1; } @@ -227,7 +227,7 @@ do_buf(unsigned char *buf, int buflen, int type, unsigned char flags, break; case 0: - i = UTF8_getc(p, buflen, &c); + i = UTF8_getc(p, q - p, &c); if (i < 0) return -1; /* Invalid UTF8String */ p += i; diff --git a/lib/libssl/src/crypto/asn1/a_strex.c b/lib/libssl/src/crypto/asn1/a_strex.c index 248eac28f6a..462a4059bec 100644 --- a/lib/libssl/src/crypto/asn1/a_strex.c +++ b/lib/libssl/src/crypto/asn1/a_strex.c @@ -111,7 +111,7 @@ send_fp_chars(void *arg, const void *buf, int len) { if (!arg) return 1; - if (fwrite(buf, 1, len, arg) != (unsigned int)len) + if (fwrite(buf, 1, (size_t)len, arg) != (size_t)len) return 0; return 1; } @@ -227,7 +227,7 @@ do_buf(unsigned char *buf, int buflen, int type, unsigned char flags, break; case 0: - i = UTF8_getc(p, buflen, &c); + i = UTF8_getc(p, q - p, &c); if (i < 0) return -1; /* Invalid UTF8String */ p += i; |