diff options
| author | ho <> | 2003-04-06 09:22:53 +0000 |
|---|---|---|
| committer | ho <> | 2003-04-06 09:22:53 +0000 |
| commit | 076c25d273764c843263b4783f51a4972e8c301b (patch) | |
| tree | 53edb40fe170a6d578386f380e5c0c39c150ed78 /src/lib/libcrypto/bn | |
| parent | d0dbce9d2ce1f0022e91a9d6007272d786be2a60 (diff) | |
| download | openbsd-076c25d273764c843263b4783f51a4972e8c301b.tar.gz openbsd-076c25d273764c843263b4783f51a4972e8c301b.tar.bz2 openbsd-076c25d273764c843263b4783f51a4972e8c301b.zip | |
sprintf->snprintf. deraadt@ suggestions and ok
Diffstat (limited to 'src/lib/libcrypto/bn')
| -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 | } |
