From: guenther Date: Sun, 20 Apr 2014 19:52:41 +0000 (+0000) Subject: Restore beck's rev 1.7: snprintf() was reviewed. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=656814a7f7987415dc923a7d40aff82115498b54;p=openbsd Restore beck's rev 1.7: snprintf() was reviewed. Also, use sizeof() for snprintf()'s size argument --- 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);