From: miod Date: Thu, 17 Apr 2014 19:33:42 +0000 (+0000) Subject: sprintf: bad. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a5efc3bbda19d0f8185e190dcc7a7baedf8b80fe;p=openbsd sprintf: bad. snprintf: good. snprintf with a correct size: better! (harmless in this case) --- diff --git a/lib/libcrypto/asn1/a_strex.c b/lib/libcrypto/asn1/a_strex.c index 713b3cb028e..65f95532a33 100644 --- a/lib/libcrypto/asn1/a_strex.c +++ b/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/lib/libssl/src/crypto/asn1/a_strex.c b/lib/libssl/src/crypto/asn1/a_strex.c index 713b3cb028e..65f95532a33 100644 --- a/lib/libssl/src/crypto/asn1/a_strex.c +++ b/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; }