diff options
author | deraadt <> | 2005-04-23 15:10:24 +0000 |
---|---|---|
committer | deraadt <> | 2005-04-23 15:10:24 +0000 |
commit | 666d98246ffec467cced3798a97a31940f42673a (patch) | |
tree | 34afce863345aea7b2d2b6e19641cdd25625a95d | |
parent | 06a0bc5cf18da4b710030f2c46a861ae6ad79f30 (diff) | |
download | openbsd-666d98246ffec467cced3798a97a31940f42673a.tar.gz openbsd-666d98246ffec467cced3798a97a31940f42673a.tar.bz2 openbsd-666d98246ffec467cced3798a97a31940f42673a.zip |
fix lies about snprintf
-rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/b_print.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index fbff331796..880dc69303 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -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; |
diff --git a/src/lib/libssl/src/crypto/bio/b_print.c b/src/lib/libssl/src/crypto/bio/b_print.c index fbff331796..880dc69303 100644 --- a/src/lib/libssl/src/crypto/bio/b_print.c +++ b/src/lib/libssl/src/crypto/bio/b_print.c | |||
@@ -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; |