diff options
author | 2014-07-10 21:58:08 +0000 | |
---|---|---|
committer | 2014-07-10 21:58:08 +0000 | |
commit | 9f264ca7908b02b9c1a226a745d18ca3cf22ecd3 (patch) | |
tree | 69849183b0f7b3cef4ddb1470841e3f1fd282e8c /lib/libssl/src | |
parent | Simplify realloc() usage; ok tedu@ (diff) | |
download | wireguard-openbsd-9f264ca7908b02b9c1a226a745d18ca3cf22ecd3.tar.xz wireguard-openbsd-9f264ca7908b02b9c1a226a745d18ca3cf22ecd3.zip |
Use size_t as realloc() size argument whenever possible. ok tedu@
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_enum.c | 7 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_string.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libssl/src/crypto/asn1/f_enum.c b/lib/libssl/src/crypto/asn1/f_enum.c index 952b908985c..7cf0abb428c 100644 --- a/lib/libssl/src/crypto/asn1/f_enum.c +++ b/lib/libssl/src/crypto/asn1/f_enum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: f_enum.c,v 1.12 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: f_enum.c,v 1.13 2014/07/10 21:58:08 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -104,7 +104,8 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) int i, j,k, m,n, again, bufsize; unsigned char *s = NULL, *sp; unsigned char *bufp; - int num = 0, slen = 0, first = 1; + int first = 1; + size_t num = 0, slen = 0; bs->type = V_ASN1_ENUMERATED; @@ -154,7 +155,7 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) } i /= 2; if (num + i > slen) { - sp = realloc(s, (unsigned int)num + i); + sp = realloc(s, num + i); if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE); diff --git a/lib/libssl/src/crypto/asn1/f_string.c b/lib/libssl/src/crypto/asn1/f_string.c index edf43779a91..eec05f81100 100644 --- a/lib/libssl/src/crypto/asn1/f_string.c +++ b/lib/libssl/src/crypto/asn1/f_string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: f_string.c,v 1.14 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: f_string.c,v 1.15 2014/07/10 21:58:08 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -102,7 +102,8 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) int i, j, k, m, n, again, bufsize; unsigned char *s = NULL, *sp; unsigned char *bufp; - int num = 0, slen = 0, first = 1; + int first = 1; + size_t num = 0, slen = 0; bufsize = BIO_gets(bp, buf, size); for (;;) { @@ -150,7 +151,7 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) } i /= 2; if (num + i > slen) { - sp = realloc(s, (unsigned int)num + i); + sp = realloc(s, num + i); if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE); |