diff options
author | Richard Levitte <levitte@openssl.org> | 2003-12-27 14:40:17 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2003-12-27 14:40:17 +0000 |
commit | d420ac2c7d4ba9d99ff2c257a3ad71ecc6d876e2 (patch) | |
tree | 84414c7d794c6286588d2042f060036378311348 /crypto/bn/bn_print.c | |
parent | b79aa47a0c8478bea62fc2bb55f99e0be172da3d (diff) | |
download | openssl-d420ac2c7d4ba9d99ff2c257a3ad71ecc6d876e2.tar.gz |
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.c | 5 |
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++; } } |