summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_print.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2003-12-27 14:40:17 +0000
committerRichard Levitte <levitte@openssl.org>2003-12-27 14:40:17 +0000
commitd420ac2c7d4ba9d99ff2c257a3ad71ecc6d876e2 (patch)
tree84414c7d794c6286588d2042f060036378311348 /crypto/bn/bn_print.c
parentb79aa47a0c8478bea62fc2bb55f99e0be172da3d (diff)
Use BUF_strlcpy() instead of strcpy().
Use BUF_strlcat() instead of strcat(). Use BIO_snprintf() instead of sprintf(). In some cases, keep better track of buffer lengths. This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
Diffstat (limited to 'crypto/bn/bn_print.c')
-rw-r--r--crypto/bn/bn_print.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c
index 4bc51d3033..7f7b36a122 100644
--- a/crypto/bn/bn_print.c
+++ b/crypto/bn/bn_print.c
@@ -119,6 +119,7 @@ char *BN_bn2dec(const BIGNUM *a)
}
if ((t=BN_dup(a)) == NULL) goto err;
+#define BUF_REMAIN (num+3 - (size_t)(p - buf))
p=buf;
lp=bn_data;
if (t->neg) *(p++)='-';
@@ -139,12 +140,12 @@ char *BN_bn2dec(const BIGNUM *a)
/* We now have a series of blocks, BN_DEC_NUM chars
* in length, where the last one needs truncation.
* The blocks need to be reversed in order. */
- sprintf(p,BN_DEC_FMT1,*lp);
+ BIO_snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp);
while (*p) p++;
while (lp != bn_data)
{
lp--;
- sprintf(p,BN_DEC_FMT2,*lp);
+ BIO_snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp);
while (*p) p++;
}
}