diff options
Diffstat (limited to 'src/lib/libcrypto/bio/b_print.c')
-rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 165f046295..8b753e7ca0 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -576,7 +576,7 @@ abs_val(LDOUBLE value) | |||
576 | } | 576 | } |
577 | 577 | ||
578 | static LDOUBLE | 578 | static LDOUBLE |
579 | pow_10(int in_exp) | 579 | pow10(int in_exp) |
580 | { | 580 | { |
581 | LDOUBLE result = 1; | 581 | LDOUBLE result = 1; |
582 | while (in_exp) { | 582 | while (in_exp) { |
@@ -639,11 +639,11 @@ fmtfp( | |||
639 | 639 | ||
640 | /* we "cheat" by converting the fractional part to integer by | 640 | /* we "cheat" by converting the fractional part to integer by |
641 | multiplying by a factor of 10 */ | 641 | multiplying by a factor of 10 */ |
642 | fracpart = roundv((pow_10(max)) * (ufvalue - intpart)); | 642 | fracpart = roundv((pow10(max)) * (ufvalue - intpart)); |
643 | 643 | ||
644 | if (fracpart >= (long)pow_10(max)) { | 644 | if (fracpart >= (long)pow10(max)) { |
645 | intpart++; | 645 | intpart++; |
646 | fracpart -= (long)pow_10(max); | 646 | fracpart -= (long)pow10(max); |
647 | } | 647 | } |
648 | 648 | ||
649 | /* convert integer part */ | 649 | /* convert integer part */ |
@@ -806,6 +806,7 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
806 | } | 806 | } |
807 | 807 | ||
808 | /* As snprintf is not available everywhere, we provide our own implementation. | 808 | /* As snprintf is not available everywhere, we provide our own implementation. |
809 | * In case of overflow or error, this returns -1. | ||
809 | * This function has nothing to do with BIOs, but it's closely related | 810 | * This function has nothing to do with BIOs, but it's closely related |
810 | * to BIO_printf, and we need *some* name prefix ... | 811 | * to BIO_printf, and we need *some* name prefix ... |
811 | * (XXX the function should be renamed, but to what?) */ | 812 | * (XXX the function should be renamed, but to what?) */ |
@@ -830,10 +831,10 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | |||
830 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); | 831 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); |
831 | 832 | ||
832 | if (truncated) | 833 | if (truncated) |
833 | /* In case of truncation, return -1 like traditional snprintf. | 834 | /* In case of truncation, return -1 unlike traditional snprintf. |
834 | * (Current drafts for ISO/IEC 9899 say snprintf should return | 835 | * (Current drafts for ISO/IEC 9899 say snprintf should return |
835 | * the number of characters that would have been written, | 836 | * the number of characters that would have been written, |
836 | * had the buffer been large enough.) */ | 837 | * had the buffer been large enough, as it did historically.) */ |
837 | return -1; | 838 | return -1; |
838 | else | 839 | else |
839 | return (retlen <= INT_MAX) ? (int)retlen : -1; | 840 | return (retlen <= INT_MAX) ? (int)retlen : -1; |