diff options
author | Rich Salz <rsalz@openssl.org> | 2017-06-14 20:34:37 -0400 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-07-05 11:32:35 +1000 |
commit | 0904e79a6e6109240d5a552f2699408b26cf63ee (patch) | |
tree | df0b4928a751b05779164cf7dd84265407bea332 /crypto/pem | |
parent | ff281ee8369350d88e8b57af139614f5683e1e8c (diff) |
Undo commit d420ac2
[extended tests]
Original text:
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>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3701)
Diffstat (limited to 'crypto/pem')
-rw-r--r-- | crypto/pem/pem_lib.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index e937b0e014..f18dcca357 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -81,9 +81,9 @@ void PEM_proc_type(char *buf, int type) else str = "BAD-TYPE"; - OPENSSL_strlcat(buf, "Proc-Type: 4,", PEM_BUFSIZE); - OPENSSL_strlcat(buf, str, PEM_BUFSIZE); - OPENSSL_strlcat(buf, "\n", PEM_BUFSIZE); + strcat(buf, "Proc-Type: 4,"); + strcat(buf, str); + strcat(buf, "\n"); } void PEM_dek_info(char *buf, const char *type, int len, char *str) @@ -92,12 +92,10 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str) long i; int j; - OPENSSL_strlcat(buf, "DEK-Info: ", PEM_BUFSIZE); - OPENSSL_strlcat(buf, type, PEM_BUFSIZE); - OPENSSL_strlcat(buf, ",", PEM_BUFSIZE); + strcat(buf, "DEK-Info: "); + strcat(buf, type); + strcat(buf, ","); j = strlen(buf); - if (j + (len * 2) + 1 > PEM_BUFSIZE) - return; for (i = 0; i < len; i++) { buf[j + i * 2] = map[(str[i] >> 4) & 0x0f]; buf[j + i * 2 + 1] = map[(str[i]) & 0x0f]; |