summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_string.c
diff options
context:
space:
mode:
authormiod <>2014-07-10 21:58:08 +0000
committermiod <>2014-07-10 21:58:08 +0000
commit69d6ecdeec2fa30f31701826fda6efe8c1a11732 (patch)
tree57d193aa6b7f90c2bd6c90d6e0ba589bce60364a /src/lib/libcrypto/asn1/f_string.c
parentb72cc7a509b05335b9f244d5b7a6a12a03c0bd7f (diff)
downloadopenbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.tar.gz
openbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.tar.bz2
openbsd-69d6ecdeec2fa30f31701826fda6efe8c1a11732.zip
Use size_t as realloc() size argument whenever possible. ok tedu@
Diffstat (limited to 'src/lib/libcrypto/asn1/f_string.c')
-rw-r--r--src/lib/libcrypto/asn1/f_string.c7
1 files changed, 4 insertions, 3 deletions
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);