From 656814a7f7987415dc923a7d40aff82115498b54 Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 20 Apr 2014 19:52:41 +0000 Subject: [PATCH] Restore beck's rev 1.7: snprintf() was reviewed. Also, use sizeof() for snprintf()'s size argument --- lib/libcrypto/pem/pem_pkey.c | 6 ++++-- lib/libssl/src/crypto/pem/pem_pkey.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/libcrypto/pem/pem_pkey.c b/lib/libcrypto/pem/pem_pkey.c index c8cf00dd879..5274447b243 100644 --- a/lib/libcrypto/pem/pem_pkey.c +++ b/lib/libcrypto/pem/pem_pkey.c @@ -147,7 +147,8 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, (char *)kstr, klen, cb, u); - snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str); + (void) snprintf(pem_str, sizeof(pem_str), "%s PRIVATE KEY", + x->ameth->pem_str); return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, pem_str,bp,x,enc,kstr,klen,cb,u); } @@ -199,7 +200,8 @@ int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) if (!x->ameth || !x->ameth->param_encode) return 0; - snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str); + (void) snprintf(pem_str, sizeof(pem_str), "%s PARAMETERS", + x->ameth->pem_str); return PEM_ASN1_write_bio( (i2d_of_void *)x->ameth->param_encode, pem_str,bp,x,NULL,NULL,0,0,NULL); diff --git a/lib/libssl/src/crypto/pem/pem_pkey.c b/lib/libssl/src/crypto/pem/pem_pkey.c index c8cf00dd879..5274447b243 100644 --- a/lib/libssl/src/crypto/pem/pem_pkey.c +++ b/lib/libssl/src/crypto/pem/pem_pkey.c @@ -147,7 +147,8 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, (char *)kstr, klen, cb, u); - snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str); + (void) snprintf(pem_str, sizeof(pem_str), "%s PRIVATE KEY", + x->ameth->pem_str); return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, pem_str,bp,x,enc,kstr,klen,cb,u); } @@ -199,7 +200,8 @@ int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) if (!x->ameth || !x->ameth->param_encode) return 0; - snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str); + (void) snprintf(pem_str, sizeof(pem_str), "%s PARAMETERS", + x->ameth->pem_str); return PEM_ASN1_write_bio( (i2d_of_void *)x->ameth->param_encode, pem_str,bp,x,NULL,NULL,0,0,NULL); -- 2.20.1