summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-10 21:58:09 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-10 21:58:09 +0000
commit8fc26b8bb8290e101bae6dc280b2e608b5ee1d7b (patch)
tree4e7e1b560fa9151fd59180b11a7c021f2bcd4e6b
parent02f2c586e022c61ef4b3a945c859a636d1ee4352 (diff)
Use size_t as realloc() size argument whenever possible. ok tedu@
-rw-r--r--lib/libssl/src/crypto/asn1/f_enum.c7
-rw-r--r--lib/libssl/src/crypto/asn1/f_string.c7
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);