From 2ccc609da4ed343c280c621d2856f9b8969c19d7 Mon Sep 17 00:00:00 2001 From: miod <> Date: Thu, 17 Apr 2014 19:33:42 +0000 Subject: sprintf: bad. snprintf: good. snprintf with a correct size: better! (harmless in this case) --- src/lib/libcrypto/asn1/a_strex.c | 2 +- src/lib/libssl/src/crypto/asn1/a_strex.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 713b3cb028..65f95532a3 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c @@ -149,7 +149,7 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch return 2; } if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { - (void) snprintf(tmphex, 11, "\\%02X", chtmp); + (void) snprintf(tmphex, sizeof tmphex, "\\%02X", chtmp); if(!io_ch(arg, tmphex, 3)) return -1; return 3; } diff --git a/src/lib/libssl/src/crypto/asn1/a_strex.c b/src/lib/libssl/src/crypto/asn1/a_strex.c index 713b3cb028..65f95532a3 100644 --- a/src/lib/libssl/src/crypto/asn1/a_strex.c +++ b/src/lib/libssl/src/crypto/asn1/a_strex.c @@ -149,7 +149,7 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch return 2; } if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { - (void) snprintf(tmphex, 11, "\\%02X", chtmp); + (void) snprintf(tmphex, sizeof tmphex, "\\%02X", chtmp); if(!io_ch(arg, tmphex, 3)) return -1; return 3; } -- cgit v1.2.3-55-g6feb