From b121c76a6e9d1610f48fa1d06cd592e1feb2e4ed Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sat, 19 Apr 2014 11:43:08 +0000 Subject: We'll interpret a (void) cast on snprintf() to mean it's been verified that truncation is either desirable, not an issue, or is detected and handled later ok deraadt@ --- lib/libcrypto/asn1/a_gentm.c | 2 +- lib/libcrypto/asn1/a_mbstr.c | 4 ++-- lib/libcrypto/asn1/a_strex.c | 6 +++--- lib/libcrypto/asn1/a_utctm.c | 2 +- lib/libcrypto/asn1/asn1_lib.c | 4 ++-- lib/libcrypto/asn1/asn1_par.c | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/libcrypto/asn1') diff --git a/lib/libcrypto/asn1/a_gentm.c b/lib/libcrypto/asn1/a_gentm.c index 856aaf0c77d..f331bff3202 100644 --- a/lib/libcrypto/asn1/a_gentm.c +++ b/lib/libcrypto/asn1/a_gentm.c @@ -244,7 +244,7 @@ ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, s->data = (unsigned char *)p; } - (void) snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ", ts->tm_year + 1900, + snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ", ts->tm_year + 1900, ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec); s->length = strlen(p); s->type = V_ASN1_GENERALIZEDTIME; diff --git a/lib/libcrypto/asn1/a_mbstr.c b/lib/libcrypto/asn1/a_mbstr.c index 5a909d6ae27..6528161c41a 100644 --- a/lib/libcrypto/asn1/a_mbstr.c +++ b/lib/libcrypto/asn1/a_mbstr.c @@ -150,14 +150,14 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, if ((minsize > 0) && (nchar < minsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); - (void) snprintf(strbuf, sizeof strbuf, "%ld", minsize); + snprintf(strbuf, sizeof strbuf, "%ld", minsize); ERR_add_error_data(2, "minsize=", strbuf); return -1; } if ((maxsize > 0) && (nchar > maxsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); - (void) snprintf(strbuf, sizeof strbuf, "%ld", maxsize); + snprintf(strbuf, sizeof strbuf, "%ld", maxsize); ERR_add_error_data(2, "maxsize=", strbuf); return -1; } diff --git a/lib/libcrypto/asn1/a_strex.c b/lib/libcrypto/asn1/a_strex.c index 7dc531a2d8b..e92c1663038 100644 --- a/lib/libcrypto/asn1/a_strex.c +++ b/lib/libcrypto/asn1/a_strex.c @@ -125,12 +125,12 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch if(c > 0xffffffffL) return -1; if(c > 0xffff) { - (void) snprintf(tmphex, sizeof tmphex, "\\W%08lX", c); + snprintf(tmphex, sizeof tmphex, "\\W%08lX", c); if(!io_ch(arg, tmphex, 10)) return -1; return 10; } if(c > 0xff) { - (void) snprintf(tmphex, sizeof tmphex, "\\U%04lX", c); + snprintf(tmphex, sizeof tmphex, "\\U%04lX", c); if(!io_ch(arg, tmphex, 6)) return -1; return 6; } @@ -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, sizeof tmphex, "\\%02X", chtmp); + snprintf(tmphex, sizeof tmphex, "\\%02X", chtmp); if(!io_ch(arg, tmphex, 3)) return -1; return 3; } diff --git a/lib/libcrypto/asn1/a_utctm.c b/lib/libcrypto/asn1/a_utctm.c index a2325f25252..0120b952b39 100644 --- a/lib/libcrypto/asn1/a_utctm.c +++ b/lib/libcrypto/asn1/a_utctm.c @@ -205,7 +205,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, s->data=(unsigned char *)p; } - (void) snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, + snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_UTCTIME; diff --git a/lib/libcrypto/asn1/asn1_lib.c b/lib/libcrypto/asn1/asn1_lib.c index 49d650b1256..86cfdd3967d 100644 --- a/lib/libcrypto/asn1/asn1_lib.c +++ b/lib/libcrypto/asn1/asn1_lib.c @@ -467,8 +467,8 @@ asn1_add_error(const unsigned char *address, int offset) { char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1]; - (void) snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address); - (void) snprintf(buf2, sizeof buf2, "%d", offset); + snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address); + snprintf(buf2, sizeof buf2, "%d", offset); ERR_add_error_data(4, "address=", buf1, " offset=", buf2); } diff --git a/lib/libcrypto/asn1/asn1_par.c b/lib/libcrypto/asn1/asn1_par.c index 064b3dcb228..8085d1e5704 100644 --- a/lib/libcrypto/asn1/asn1_par.c +++ b/lib/libcrypto/asn1/asn1_par.c @@ -85,13 +85,13 @@ asn1_print_info(BIO *bp, int tag, int xclass, int constructed, p = str; if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) - (void) snprintf(str, sizeof str, "priv [ %d ] ", tag); + snprintf(str, sizeof str, "priv [ %d ] ", tag); else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) - (void) snprintf(str, sizeof str, "cont [ %d ]", tag); + snprintf(str, sizeof str, "cont [ %d ]", tag); else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) - (void) snprintf(str, sizeof str, "appl [ %d ]", tag); + snprintf(str, sizeof str, "appl [ %d ]", tag); else if (tag > 30) - (void) snprintf(str, sizeof str, "", tag); + snprintf(str, sizeof str, "", tag); else p = ASN1_tag2str(tag); -- cgit v1.2.3