diff options
author | miod <> | 2014-04-17 19:33:42 +0000 |
---|---|---|
committer | miod <> | 2014-04-17 19:33:42 +0000 |
commit | 2ccc609da4ed343c280c621d2856f9b8969c19d7 (patch) | |
tree | cd188c5bbc6b80c938cbe32d3e82c1190c278399 | |
parent | 153c46d19d82a5b1fc1fae9d017d086b0d86b929 (diff) | |
download | openbsd-2ccc609da4ed343c280c621d2856f9b8969c19d7.tar.gz openbsd-2ccc609da4ed343c280c621d2856f9b8969c19d7.tar.bz2 openbsd-2ccc609da4ed343c280c621d2856f9b8969c19d7.zip |
sprintf: bad.
snprintf: good.
snprintf with a correct size: better!
(harmless in this case)
-rw-r--r-- | src/lib/libcrypto/asn1/a_strex.c | 2 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/asn1/a_strex.c | 2 |
2 files changed, 2 insertions, 2 deletions
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 | |||
149 | return 2; | 149 | return 2; |
150 | } | 150 | } |
151 | if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { | 151 | if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { |
152 | (void) snprintf(tmphex, 11, "\\%02X", chtmp); | 152 | (void) snprintf(tmphex, sizeof tmphex, "\\%02X", chtmp); |
153 | if(!io_ch(arg, tmphex, 3)) return -1; | 153 | if(!io_ch(arg, tmphex, 3)) return -1; |
154 | return 3; | 154 | return 3; |
155 | } | 155 | } |
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 | |||
149 | return 2; | 149 | return 2; |
150 | } | 150 | } |
151 | if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { | 151 | if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { |
152 | (void) snprintf(tmphex, 11, "\\%02X", chtmp); | 152 | (void) snprintf(tmphex, sizeof tmphex, "\\%02X", chtmp); |
153 | if(!io_ch(arg, tmphex, 3)) return -1; | 153 | if(!io_ch(arg, tmphex, 3)) return -1; |
154 | return 3; | 154 | return 3; |
155 | } | 155 | } |