diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_print.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index 5f46b1826c..e3b6aa235b 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
| @@ -119,6 +119,7 @@ char *BN_bn2dec(const BIGNUM *a) | |||
| 119 | } | 119 | } |
| 120 | if ((t=BN_dup(a)) == NULL) goto err; | 120 | if ((t=BN_dup(a)) == NULL) goto err; |
| 121 | 121 | ||
| 122 | #define BUF_REMAIN (num+3 - (size_t)(p - buf)) | ||
| 122 | p=buf; | 123 | p=buf; |
| 123 | lp=bn_data; | 124 | lp=bn_data; |
| 124 | if (t->neg) *(p++)='-'; | 125 | if (t->neg) *(p++)='-'; |
| @@ -139,12 +140,12 @@ char *BN_bn2dec(const BIGNUM *a) | |||
| 139 | /* We now have a series of blocks, BN_DEC_NUM chars | 140 | /* We now have a series of blocks, BN_DEC_NUM chars |
| 140 | * in length, where the last one needs truncation. | 141 | * in length, where the last one needs truncation. |
| 141 | * The blocks need to be reversed in order. */ | 142 | * The blocks need to be reversed in order. */ |
| 142 | sprintf(p,BN_DEC_FMT1,*lp); | 143 | snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp); |
| 143 | while (*p) p++; | 144 | while (*p) p++; |
| 144 | while (lp != bn_data) | 145 | while (lp != bn_data) |
| 145 | { | 146 | { |
| 146 | lp--; | 147 | lp--; |
| 147 | sprintf(p,BN_DEC_FMT2,*lp); | 148 | snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp); |
| 148 | while (*p) p++; | 149 | while (*p) p++; |
| 149 | } | 150 | } |
| 150 | } | 151 | } |
