diff options
author | miod <> | 2014-07-10 21:58:08 +0000 |
---|---|---|
committer | miod <> | 2014-07-10 21:58:08 +0000 |
commit | 69d6ecdeec2fa30f31701826fda6efe8c1a11732 (patch) | |
tree | 57d193aa6b7f90c2bd6c90d6e0ba589bce60364a | |
parent | b72cc7a509b05335b9f244d5b7a6a12a03c0bd7f (diff) | |
download | openbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.tar.gz openbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.tar.bz2 openbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.zip |
Use size_t as realloc() size argument whenever possible. ok tedu@
-rw-r--r-- | src/lib/libcrypto/asn1/f_enum.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/f_string.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/asn1/f_enum.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/asn1/f_string.c | 7 |
4 files changed, 16 insertions, 12 deletions
diff --git a/src/lib/libcrypto/asn1/f_enum.c b/src/lib/libcrypto/asn1/f_enum.c index 952b908985..7cf0abb428 100644 --- a/src/lib/libcrypto/asn1/f_enum.c +++ b/src/lib/libcrypto/asn1/f_enum.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_enum.c,v 1.12 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: f_enum.c,v 1.13 2014/07/10 21:58:08 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -104,7 +104,8 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
104 | int i, j,k, m,n, again, bufsize; | 104 | int i, j,k, m,n, again, bufsize; |
105 | unsigned char *s = NULL, *sp; | 105 | unsigned char *s = NULL, *sp; |
106 | unsigned char *bufp; | 106 | unsigned char *bufp; |
107 | int num = 0, slen = 0, first = 1; | 107 | int first = 1; |
108 | size_t num = 0, slen = 0; | ||
108 | 109 | ||
109 | bs->type = V_ASN1_ENUMERATED; | 110 | bs->type = V_ASN1_ENUMERATED; |
110 | 111 | ||
@@ -154,7 +155,7 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
154 | } | 155 | } |
155 | i /= 2; | 156 | i /= 2; |
156 | if (num + i > slen) { | 157 | if (num + i > slen) { |
157 | sp = realloc(s, (unsigned int)num + i); | 158 | sp = realloc(s, num + i); |
158 | if (sp == NULL) { | 159 | if (sp == NULL) { |
159 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, | 160 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, |
160 | ERR_R_MALLOC_FAILURE); | 161 | ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c index edf43779a9..eec05f8110 100644 --- a/src/lib/libcrypto/asn1/f_string.c +++ b/src/lib/libcrypto/asn1/f_string.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_string.c,v 1.14 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: f_string.c,v 1.15 2014/07/10 21:58:08 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -102,7 +102,8 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
102 | int i, j, k, m, n, again, bufsize; | 102 | int i, j, k, m, n, again, bufsize; |
103 | unsigned char *s = NULL, *sp; | 103 | unsigned char *s = NULL, *sp; |
104 | unsigned char *bufp; | 104 | unsigned char *bufp; |
105 | int num = 0, slen = 0, first = 1; | 105 | int first = 1; |
106 | size_t num = 0, slen = 0; | ||
106 | 107 | ||
107 | bufsize = BIO_gets(bp, buf, size); | 108 | bufsize = BIO_gets(bp, buf, size); |
108 | for (;;) { | 109 | for (;;) { |
@@ -150,7 +151,7 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
150 | } | 151 | } |
151 | i /= 2; | 152 | i /= 2; |
152 | if (num + i > slen) { | 153 | if (num + i > slen) { |
153 | sp = realloc(s, (unsigned int)num + i); | 154 | sp = realloc(s, num + i); |
154 | if (sp == NULL) { | 155 | if (sp == NULL) { |
155 | ASN1err(ASN1_F_A2I_ASN1_STRING, | 156 | ASN1err(ASN1_F_A2I_ASN1_STRING, |
156 | ERR_R_MALLOC_FAILURE); | 157 | ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/asn1/f_enum.c b/src/lib/libssl/src/crypto/asn1/f_enum.c index 952b908985..7cf0abb428 100644 --- a/src/lib/libssl/src/crypto/asn1/f_enum.c +++ b/src/lib/libssl/src/crypto/asn1/f_enum.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_enum.c,v 1.12 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: f_enum.c,v 1.13 2014/07/10 21:58:08 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -104,7 +104,8 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
104 | int i, j,k, m,n, again, bufsize; | 104 | int i, j,k, m,n, again, bufsize; |
105 | unsigned char *s = NULL, *sp; | 105 | unsigned char *s = NULL, *sp; |
106 | unsigned char *bufp; | 106 | unsigned char *bufp; |
107 | int num = 0, slen = 0, first = 1; | 107 | int first = 1; |
108 | size_t num = 0, slen = 0; | ||
108 | 109 | ||
109 | bs->type = V_ASN1_ENUMERATED; | 110 | bs->type = V_ASN1_ENUMERATED; |
110 | 111 | ||
@@ -154,7 +155,7 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
154 | } | 155 | } |
155 | i /= 2; | 156 | i /= 2; |
156 | if (num + i > slen) { | 157 | if (num + i > slen) { |
157 | sp = realloc(s, (unsigned int)num + i); | 158 | sp = realloc(s, num + i); |
158 | if (sp == NULL) { | 159 | if (sp == NULL) { |
159 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, | 160 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, |
160 | ERR_R_MALLOC_FAILURE); | 161 | ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/asn1/f_string.c b/src/lib/libssl/src/crypto/asn1/f_string.c index edf43779a9..eec05f8110 100644 --- a/src/lib/libssl/src/crypto/asn1/f_string.c +++ b/src/lib/libssl/src/crypto/asn1/f_string.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_string.c,v 1.14 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: f_string.c,v 1.15 2014/07/10 21:58:08 miod Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -102,7 +102,8 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
102 | int i, j, k, m, n, again, bufsize; | 102 | int i, j, k, m, n, again, bufsize; |
103 | unsigned char *s = NULL, *sp; | 103 | unsigned char *s = NULL, *sp; |
104 | unsigned char *bufp; | 104 | unsigned char *bufp; |
105 | int num = 0, slen = 0, first = 1; | 105 | int first = 1; |
106 | size_t num = 0, slen = 0; | ||
106 | 107 | ||
107 | bufsize = BIO_gets(bp, buf, size); | 108 | bufsize = BIO_gets(bp, buf, size); |
108 | for (;;) { | 109 | for (;;) { |
@@ -150,7 +151,7 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
150 | } | 151 | } |
151 | i /= 2; | 152 | i /= 2; |
152 | if (num + i > slen) { | 153 | if (num + i > slen) { |
153 | sp = realloc(s, (unsigned int)num + i); | 154 | sp = realloc(s, num + i); |
154 | if (sp == NULL) { | 155 | if (sp == NULL) { |
155 | ASN1err(ASN1_F_A2I_ASN1_STRING, | 156 | ASN1err(ASN1_F_A2I_ASN1_STRING, |
156 | ERR_R_MALLOC_FAILURE); | 157 | ERR_R_MALLOC_FAILURE); |