From: guenther Date: Sat, 19 Apr 2014 11:43:07 +0000 (+0000) Subject: We'll interpret a (void) cast on snprintf() to mean it's been verified that X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5359f6d5b69575fb59707ce20998f2081c7d7a2f;p=openbsd 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@ --- 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); diff --git a/lib/libcrypto/bio/b_dump.c b/lib/libcrypto/bio/b_dump.c index 61c9fe20a3a..740686c957b 100644 --- a/lib/libcrypto/bio/b_dump.c +++ b/lib/libcrypto/bio/b_dump.c @@ -108,14 +108,14 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), for (i = 0; i < rows; i++) { buf[0] = '\0'; /* start with empty string */ strlcpy(buf, str, sizeof buf); - (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); + snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); strlcat(buf, tmp, sizeof buf); for (j = 0; j < dump_width; j++) { if (((i*dump_width) + j) >= len) { strlcat(buf, " ", sizeof buf); } else { ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, + snprintf(tmp, sizeof tmp, "%02x%c", ch, j == 7 ? '-' : ' '); strlcat(buf, tmp, sizeof buf); } @@ -125,7 +125,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), if (((i*dump_width) + j) >= len) break; ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%c", + snprintf(tmp, sizeof tmp, "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); strlcat(buf, tmp, sizeof buf); } @@ -137,7 +137,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), } #ifdef TRUNCATE if (trc > 0) { - (void) snprintf(buf, sizeof buf, "%s%04x - \n", + snprintf(buf, sizeof buf, "%s%04x - \n", str, len + trc); ret += cb((void *)buf, strlen(buf), u); } diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index a82c79a1b08..a6dd43f397b 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -543,7 +543,7 @@ BIO_accept(int sock, char **addr) goto end; } *addr = p; - (void) snprintf(*addr, nl, "%s:%s", h, s); + snprintf(*addr, nl, "%s:%s", h, s); goto end; } while (0); #endif @@ -558,7 +558,7 @@ BIO_accept(int sock, char **addr) } *addr = p; } - (void) snprintf(*addr, 24, "%d.%d.%d.%d:%d", + snprintf(*addr, 24, "%d.%d.%d.%d:%d", (unsigned char)(l >> 24L) & 0xff, (unsigned char)(l >> 16L) & 0xff, (unsigned char)(l >> 8L) & 0xff, (unsigned char)(l) & 0xff, port); diff --git a/lib/libcrypto/bio/bio_cb.c b/lib/libcrypto/bio/bio_cb.c index a272bf969a9..133d2b77dc3 100644 --- a/lib/libcrypto/bio/bio_cb.c +++ b/lib/libcrypto/bio/bio_cb.c @@ -76,62 +76,62 @@ BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, if (BIO_CB_RETURN & cmd) r = ret; - (void) snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); + snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); p = &(buf[14]); p_maxlen = sizeof buf - 14; switch (cmd) { case BIO_CB_FREE: - (void) snprintf(p, p_maxlen, "Free - %s\n", bio->method->name); + snprintf(p, p_maxlen, "Free - %s\n", bio->method->name); break; case BIO_CB_READ: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "read(%d,%lu) - %s fd=%d\n", bio->num, (unsigned long)argi, bio->method->name, bio->num); else - (void) snprintf(p, p_maxlen, "read(%d,%lu) - %s\n", + snprintf(p, p_maxlen, "read(%d,%lu) - %s\n", bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_WRITE: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "write(%d,%lu) - %s fd=%d\n", bio->num, (unsigned long)argi, bio->method->name, bio->num); else - (void) snprintf(p, p_maxlen, "write(%d,%lu) - %s\n", + snprintf(p, p_maxlen, "write(%d,%lu) - %s\n", bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_PUTS: - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "puts() - %s\n", bio->method->name); break; case BIO_CB_GETS: - (void) snprintf(p, p_maxlen, "gets(%lu) - %s\n", + snprintf(p, p_maxlen, "gets(%lu) - %s\n", (unsigned long)argi, bio->method->name); break; case BIO_CB_CTRL: - (void) snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", + snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", (unsigned long)argi, bio->method->name); break; case BIO_CB_RETURN|BIO_CB_READ: - (void) snprintf(p, p_maxlen, "read return %ld\n", ret); + snprintf(p, p_maxlen, "read return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_WRITE: - (void) snprintf(p, p_maxlen, "write return %ld\n", ret); + snprintf(p, p_maxlen, "write return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_GETS: - (void) snprintf(p, p_maxlen, "gets return %ld\n", ret); + snprintf(p, p_maxlen, "gets return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_PUTS: - (void) snprintf(p, p_maxlen, "puts return %ld\n", ret); + snprintf(p, p_maxlen, "puts return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_CTRL: - (void) snprintf(p, p_maxlen, "ctrl return %ld\n", ret); + snprintf(p, p_maxlen, "ctrl return %ld\n", ret); break; default: - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "bio callback - unknown type (%d)\n", cmd); break; } diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c index fca5d5e853f..45815fd6968 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -482,7 +482,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) char buf[16]; unsigned char *p = ptr; - (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", + snprintf(buf, sizeof buf, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); if (data->param_hostname != NULL) free(data->param_hostname); @@ -491,7 +491,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) } else if (num == 3) { char buf[DECIMAL_SIZE(int) + 1]; - (void) snprintf(buf, sizeof buf, "%d", + snprintf(buf, sizeof buf, "%d", *(int *)ptr); if (data->param_port != NULL) free(data->param_port); diff --git a/lib/libcrypto/bn/bn_print.c b/lib/libcrypto/bn/bn_print.c index e2cab2497f6..49efbcb9a9a 100644 --- a/lib/libcrypto/bn/bn_print.c +++ b/lib/libcrypto/bn/bn_print.c @@ -147,12 +147,12 @@ char *BN_bn2dec(const BIGNUM *a) /* We now have a series of blocks, BN_DEC_NUM chars * in length, where the last one needs truncation. * The blocks need to be reversed in order. */ - (void) snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp); + snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp); while (*p) p++; while (lp != bn_data) { lp--; - (void) snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp); + snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp); while (*p) p++; } } @@ -367,10 +367,10 @@ char *BN_options(void) { init++; #ifdef BN_LLONG - (void) snprintf(data,sizeof data,"bn(%d,%d)", + snprintf(data,sizeof data,"bn(%d,%d)", (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); #else - (void) snprintf(data,sizeof data,"bn(%d,%d)", + snprintf(data,sizeof data,"bn(%d,%d)", (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); #endif } diff --git a/lib/libcrypto/conf/conf_def.c b/lib/libcrypto/conf/conf_def.c index 26aee50a45e..5ab995a5c00 100644 --- a/lib/libcrypto/conf/conf_def.c +++ b/lib/libcrypto/conf/conf_def.c @@ -435,7 +435,7 @@ err: if (buff != NULL) BUF_MEM_free(buff); if (section != NULL) free(section); if (line != NULL) *line=eline; - (void) snprintf(btmp,sizeof btmp,"%ld",eline); + snprintf(btmp,sizeof btmp,"%ld",eline); ERR_add_error_data(2,"line ",btmp); if ((h != conf->data) && (conf->data != NULL)) { diff --git a/lib/libcrypto/conf/conf_mod.c b/lib/libcrypto/conf/conf_mod.c index 24170865378..af334518444 100644 --- a/lib/libcrypto/conf/conf_mod.c +++ b/lib/libcrypto/conf/conf_mod.c @@ -233,7 +233,7 @@ static int module_run(const CONF *cnf, char *name, char *value, { char rcode[DECIMAL_SIZE(ret)+1]; CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR); - (void) snprintf(rcode, sizeof rcode, "%-8d", ret); + snprintf(rcode, sizeof rcode, "%-8d", ret); ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); } } diff --git a/lib/libcrypto/cversion.c b/lib/libcrypto/cversion.c index 7ecfaf9f2fe..326216d0840 100644 --- a/lib/libcrypto/cversion.c +++ b/lib/libcrypto/cversion.c @@ -67,7 +67,7 @@ SSLeay_version(int t) #ifdef DATE static char buf[sizeof(DATE) + 11]; - (void) snprintf(buf, sizeof buf, "built on: %s", DATE); + snprintf(buf, sizeof buf, "built on: %s", DATE); return (buf); #else return("built on: date not available"); @@ -77,7 +77,7 @@ SSLeay_version(int t) #ifdef CFLAGS static char buf[sizeof(CFLAGS) + 11]; - (void) snprintf(buf, sizeof buf, "compiler: %s", CFLAGS); + snprintf(buf, sizeof buf, "compiler: %s", CFLAGS); return (buf); #else return("compiler: information not available"); @@ -87,7 +87,7 @@ SSLeay_version(int t) #ifdef PLATFORM static char buf[sizeof(PLATFORM) + 11]; - (void) snprintf(buf, sizeof buf, "platform: %s", PLATFORM); + snprintf(buf, sizeof buf, "platform: %s", PLATFORM); return (buf); #else return("platform: information not available"); diff --git a/lib/libcrypto/des/ecb_enc.c b/lib/libcrypto/des/ecb_enc.c index b83fca71db3..f357333b979 100644 --- a/lib/libcrypto/des/ecb_enc.c +++ b/lib/libcrypto/des/ecb_enc.c @@ -97,7 +97,7 @@ const char *DES_options(void) size="int"; else size="long"; - (void) snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, + snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, size); init=0; } diff --git a/lib/libcrypto/engine/eng_padlock.c b/lib/libcrypto/engine/eng_padlock.c index d5d9a16bf24..a0076851110 100644 --- a/lib/libcrypto/engine/eng_padlock.c +++ b/lib/libcrypto/engine/eng_padlock.c @@ -177,7 +177,7 @@ padlock_bind_helper(ENGINE *e) #endif /* Generate a nice engine name with available features */ - (void) snprintf(padlock_name, sizeof(padlock_name), + snprintf(padlock_name, sizeof(padlock_name), "VIA PadLock (%s, %s)", padlock_use_rng ? "RNG" : "no-RNG", padlock_use_ace ? "ACE" : "no-ACE"); diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 0672477cc87..c4192c6bfa6 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -842,13 +842,13 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len) rs=ERR_reason_error_string(e); if (ls == NULL) - (void) snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); + snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); if (fs == NULL) - (void) snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); + snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); if (rs == NULL) - (void) snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); + snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); - (void) snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, + snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, fs?fs:fsbuf, rs?rs:rsbuf); if (strlen(buf) == len-1) { diff --git a/lib/libcrypto/err/err_prn.c b/lib/libcrypto/err/err_prn.c index 7374c0abe79..be4d5de2d24 100644 --- a/lib/libcrypto/err/err_prn.c +++ b/lib/libcrypto/err/err_prn.c @@ -79,7 +79,7 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) { ERR_error_string_n(l, buf, sizeof buf); - (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, + snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); if (cb(buf2, strlen(buf2), u) <= 0) break; /* abort outputting the error report */ diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index b3388b117d1..cc007f1206f 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -594,7 +594,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) } else { - (void) snprintf(tbuf,sizeof tbuf,".%lu",l); + snprintf(tbuf,sizeof tbuf,".%lu",l); i=strlen(tbuf); if (buf && (buf_len > 0)) { diff --git a/lib/libcrypto/pem/pem_pkey.c b/lib/libcrypto/pem/pem_pkey.c index a3b609b2f36..c8cf00dd879 100644 --- a/lib/libcrypto/pem/pem_pkey.c +++ b/lib/libcrypto/pem/pem_pkey.c @@ -147,7 +147,7 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, (char *)kstr, klen, cb, u); - (void) snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str); + snprintf(pem_str, 80, "%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 +199,7 @@ int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) if (!x->ameth || !x->ameth->param_encode) return 0; - (void) snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str); + snprintf(pem_str, 80, "%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/libcrypto/ts/ts_rsp_sign.c b/lib/libcrypto/ts/ts_rsp_sign.c index e52c9ff03bc..58d58648230 100644 --- a/lib/libcrypto/ts/ts_rsp_sign.c +++ b/lib/libcrypto/ts/ts_rsp_sign.c @@ -983,7 +983,7 @@ TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time, if the elements correspond to 0, they MUST be wholly omitted, and the decimal point element also MUST be omitted." */ - (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); + snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); /* truncate and trim trailing 0 */ usecstr[precision + 1] = '\0'; p = usecstr + strlen(usecstr) - 1; diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c index 58e4c5d7221..4138c86d55c 100644 --- a/lib/libcrypto/ui/ui_lib.c +++ b/lib/libcrypto/ui/ui_lib.c @@ -844,9 +844,9 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize) + 1]; char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize) + 1]; - (void) snprintf(number1, sizeof(number1), "%d", + snprintf(number1, sizeof(number1), "%d", uis->_.string_data.result_minsize); - (void) snprintf(number2, sizeof(number2), "%d", + snprintf(number2, sizeof(number2), "%d", uis->_.string_data.result_maxsize); if (l < uis->_.string_data.result_minsize) { diff --git a/lib/libcrypto/x509/by_dir.c b/lib/libcrypto/x509/by_dir.c index 749323be1e4..ee1838a583a 100644 --- a/lib/libcrypto/x509/by_dir.c +++ b/lib/libcrypto/x509/by_dir.c @@ -336,7 +336,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, hent = NULL; } for (;;) { - (void) snprintf(b->data, b->max, "%s/%08lx.%s%d", + snprintf(b->data, b->max, "%s/%08lx.%s%d", ent->dir, h, postfix, k); #ifndef OPENSSL_NO_POSIX_IO diff --git a/lib/libcrypto/x509/x509_txt.c b/lib/libcrypto/x509/x509_txt.c index 509948618e1..8caf18a9553 100644 --- a/lib/libcrypto/x509/x509_txt.c +++ b/lib/libcrypto/x509/x509_txt.c @@ -184,7 +184,7 @@ const char *X509_verify_cert_error_string(long n) return("CRL path validation error"); default: - (void) snprintf(buf,sizeof buf,"error number %ld",n); + snprintf(buf,sizeof buf,"error number %ld",n); return(buf); } } diff --git a/lib/libcrypto/x509v3/v3_alt.c b/lib/libcrypto/x509v3/v3_alt.c index 636677df94a..95b1fa4c975 100644 --- a/lib/libcrypto/x509v3/v3_alt.c +++ b/lib/libcrypto/x509v3/v3_alt.c @@ -143,14 +143,14 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, case GEN_IPADD: p = gen->d.ip->data; if(gen->d.ip->length == 4) - (void) snprintf(oline, sizeof oline, + snprintf(oline, sizeof oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); else if(gen->d.ip->length == 16) { oline[0] = 0; for (i = 0; i < 8; i++) { - (void) snprintf(htmp, sizeof htmp, + snprintf(htmp, sizeof htmp, "%X", p[0] << 8 | p[1]); p += 2; strlcat(oline, htmp, sizeof(oline)); diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c index 4a8be9993df..9a731fe75bc 100644 --- a/lib/libssl/src/apps/apps.c +++ b/lib/libssl/src/apps/apps.c @@ -1449,7 +1449,7 @@ save_serial(char *serialfile, char *suffix, BIGNUM * serial, if (suffix == NULL) strlcpy(buf[0], serialfile, BSIZE); else - (void) snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix); + snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix); #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]); #endif @@ -1495,9 +1495,9 @@ rotate_serial(char *serialfile, char *new_suffix, char *old_suffix) BIO_printf(bio_err, "file name too long\n"); goto err; } - (void) snprintf(buf[0], sizeof buf[0], "%s.%s", + snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, new_suffix); - (void) snprintf(buf[1], sizeof buf[1], "%s.%s", + snprintf(buf[1], sizeof buf[1], "%s.%s", serialfile, old_suffix); #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", @@ -1580,7 +1580,7 @@ load_index(char *dbfile, DB_ATTR * db_attr) if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL) goto err; - (void) snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile); + snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile); dbattr_conf = NCONF_new(NULL); if (NCONF_load(dbattr_conf, buf[0], &errorline) <= 0) { if (errorline > 0) { @@ -1661,9 +1661,9 @@ save_index(const char *dbfile, const char *suffix, CA_DB * db) BIO_printf(bio_err, "file name too long\n"); goto err; } - (void) snprintf(buf[2], sizeof buf[2], "%s.attr", dbfile); - (void) snprintf(buf[1], sizeof buf[1], "%s.attr.%s", dbfile, suffix); - (void) snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, suffix); + snprintf(buf[2], sizeof buf[2], "%s.attr", dbfile); + snprintf(buf[1], sizeof buf[1], "%s.attr.%s", dbfile, suffix); + snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, suffix); #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]); #endif @@ -1710,14 +1710,14 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix) BIO_printf(bio_err, "file name too long\n"); goto err; } - (void) snprintf(buf[4], sizeof buf[4], "%s.attr", dbfile); - (void) snprintf(buf[2], sizeof buf[2], "%s.attr.%s", + snprintf(buf[4], sizeof buf[4], "%s.attr", dbfile); + snprintf(buf[2], sizeof buf[2], "%s.attr.%s", dbfile, new_suffix); - (void) snprintf(buf[0], sizeof buf[0], "%s.%s", + snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, new_suffix); - (void) snprintf(buf[1], sizeof buf[1], "%s.%s", + snprintf(buf[1], sizeof buf[1], "%s.%s", dbfile, old_suffix); - (void) snprintf(buf[3], sizeof buf[3], "%s.attr.%s", + snprintf(buf[3], sizeof buf[3], "%s.attr.%s", dbfile, old_suffix); #ifdef RL_DEBUG BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n", diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c index 3f2d10671c0..c70ca5f1686 100644 --- a/lib/libssl/src/apps/ca.c +++ b/lib/libssl/src/apps/ca.c @@ -1143,7 +1143,7 @@ ca_main(int argc, char **argv) for (k = 0; k < j; k++) { if (n >= &(buf[2][sizeof(buf[2])])) break; - (void) snprintf(n, + snprintf(n, &buf[2][0] + sizeof(buf[2]) - n, "%02X", (unsigned char) *(p++)); n += 2; diff --git a/lib/libssl/src/apps/enc.c b/lib/libssl/src/apps/enc.c index 18760113c12..c8f04106ccb 100644 --- a/lib/libssl/src/apps/enc.c +++ b/lib/libssl/src/apps/enc.c @@ -388,7 +388,7 @@ enc_main(int argc, char **argv) for (;;) { char buf[200]; - (void) snprintf(buf, sizeof buf, "enter %s %s password:", + snprintf(buf, sizeof buf, "enter %s %s password:", OBJ_nid2ln(EVP_CIPHER_nid(cipher)), (enc) ? "encryption" : "decryption"); strbuf[0] = '\0'; diff --git a/lib/libssl/src/apps/req.c b/lib/libssl/src/apps/req.c index 1ed8c84a8d6..38428f856dd 100644 --- a/lib/libssl/src/apps/req.c +++ b/lib/libssl/src/apps/req.c @@ -1081,17 +1081,17 @@ start: for (;;) { ERR_clear_error(); def = ""; } - (void) snprintf(buf, sizeof buf, "%s_value", v->name); + snprintf(buf, sizeof buf, "%s_value", v->name); if ((value = NCONF_get_string(req_conf, dn_sect, buf)) == NULL) { ERR_clear_error(); value = NULL; } - (void) snprintf(buf, sizeof buf, "%s_min", v->name); + snprintf(buf, sizeof buf, "%s_min", v->name); if (!NCONF_get_number(req_conf, dn_sect, buf, &n_min)) { ERR_clear_error(); n_min = -1; } - (void) snprintf(buf, sizeof buf, "%s_max", v->name); + snprintf(buf, sizeof buf, "%s_max", v->name); if (!NCONF_get_number(req_conf, dn_sect, buf, &n_max)) { ERR_clear_error(); n_max = -1; @@ -1131,18 +1131,18 @@ start: for (;;) { ERR_clear_error(); def = ""; } - (void) snprintf(buf, sizeof buf, "%s_value", type); + snprintf(buf, sizeof buf, "%s_value", type); if ((value = NCONF_get_string(req_conf, attr_sect, buf)) == NULL) { ERR_clear_error(); value = NULL; } - (void) snprintf(buf, sizeof buf, "%s_min", type); + snprintf(buf, sizeof buf, "%s_min", type); if (!NCONF_get_number(req_conf, attr_sect, buf, &n_min)) { ERR_clear_error(); n_min = -1; } - (void) snprintf(buf, sizeof buf, "%s_max", type); + snprintf(buf, sizeof buf, "%s_max", type); if (!NCONF_get_number(req_conf, attr_sect, buf, &n_max)) { ERR_clear_error(); n_max = -1; diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c index f74c9b9c7f9..e7fc7e2e07c 100644 --- a/lib/libssl/src/apps/s_time.c +++ b/lib/libssl/src/apps/s_time.c @@ -398,7 +398,7 @@ s_time_main(int argc, char **argv) goto end; if (s_www_path != NULL) { - (void) snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); + snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); SSL_write(scon, buf, strlen(buf)); while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) bytes_read += i; @@ -453,7 +453,7 @@ next: goto end; } if (s_www_path != NULL) { - (void) snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); + snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); SSL_write(scon, buf, strlen(buf)); while (SSL_read(scon, buf, sizeof(buf)) > 0); } @@ -490,7 +490,7 @@ next: goto end; if (s_www_path) { - (void) snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); + snprintf(buf, sizeof buf, "GET %s HTTP/1.0\r\n\r\n", s_www_path); SSL_write(scon, buf, strlen(buf)); while ((i = SSL_read(scon, buf, sizeof(buf))) > 0) bytes_read += i; diff --git a/lib/libssl/src/crypto/asn1/a_gentm.c b/lib/libssl/src/crypto/asn1/a_gentm.c index 856aaf0c77d..f331bff3202 100644 --- a/lib/libssl/src/crypto/asn1/a_gentm.c +++ b/lib/libssl/src/crypto/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/libssl/src/crypto/asn1/a_mbstr.c b/lib/libssl/src/crypto/asn1/a_mbstr.c index 5a909d6ae27..6528161c41a 100644 --- a/lib/libssl/src/crypto/asn1/a_mbstr.c +++ b/lib/libssl/src/crypto/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/libssl/src/crypto/asn1/a_strex.c b/lib/libssl/src/crypto/asn1/a_strex.c index 7dc531a2d8b..e92c1663038 100644 --- a/lib/libssl/src/crypto/asn1/a_strex.c +++ b/lib/libssl/src/crypto/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/libssl/src/crypto/asn1/a_utctm.c b/lib/libssl/src/crypto/asn1/a_utctm.c index a2325f25252..0120b952b39 100644 --- a/lib/libssl/src/crypto/asn1/a_utctm.c +++ b/lib/libssl/src/crypto/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/libssl/src/crypto/asn1/asn1_lib.c b/lib/libssl/src/crypto/asn1/asn1_lib.c index 49d650b1256..86cfdd3967d 100644 --- a/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/lib/libssl/src/crypto/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/libssl/src/crypto/asn1/asn1_par.c b/lib/libssl/src/crypto/asn1/asn1_par.c index 064b3dcb228..8085d1e5704 100644 --- a/lib/libssl/src/crypto/asn1/asn1_par.c +++ b/lib/libssl/src/crypto/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); diff --git a/lib/libssl/src/crypto/bio/b_dump.c b/lib/libssl/src/crypto/bio/b_dump.c index 61c9fe20a3a..740686c957b 100644 --- a/lib/libssl/src/crypto/bio/b_dump.c +++ b/lib/libssl/src/crypto/bio/b_dump.c @@ -108,14 +108,14 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), for (i = 0; i < rows; i++) { buf[0] = '\0'; /* start with empty string */ strlcpy(buf, str, sizeof buf); - (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); + snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); strlcat(buf, tmp, sizeof buf); for (j = 0; j < dump_width; j++) { if (((i*dump_width) + j) >= len) { strlcat(buf, " ", sizeof buf); } else { ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, + snprintf(tmp, sizeof tmp, "%02x%c", ch, j == 7 ? '-' : ' '); strlcat(buf, tmp, sizeof buf); } @@ -125,7 +125,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), if (((i*dump_width) + j) >= len) break; ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%c", + snprintf(tmp, sizeof tmp, "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); strlcat(buf, tmp, sizeof buf); } @@ -137,7 +137,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), } #ifdef TRUNCATE if (trc > 0) { - (void) snprintf(buf, sizeof buf, "%s%04x - \n", + snprintf(buf, sizeof buf, "%s%04x - \n", str, len + trc); ret += cb((void *)buf, strlen(buf), u); } diff --git a/lib/libssl/src/crypto/bio/b_sock.c b/lib/libssl/src/crypto/bio/b_sock.c index a82c79a1b08..a6dd43f397b 100644 --- a/lib/libssl/src/crypto/bio/b_sock.c +++ b/lib/libssl/src/crypto/bio/b_sock.c @@ -543,7 +543,7 @@ BIO_accept(int sock, char **addr) goto end; } *addr = p; - (void) snprintf(*addr, nl, "%s:%s", h, s); + snprintf(*addr, nl, "%s:%s", h, s); goto end; } while (0); #endif @@ -558,7 +558,7 @@ BIO_accept(int sock, char **addr) } *addr = p; } - (void) snprintf(*addr, 24, "%d.%d.%d.%d:%d", + snprintf(*addr, 24, "%d.%d.%d.%d:%d", (unsigned char)(l >> 24L) & 0xff, (unsigned char)(l >> 16L) & 0xff, (unsigned char)(l >> 8L) & 0xff, (unsigned char)(l) & 0xff, port); diff --git a/lib/libssl/src/crypto/bio/bio_cb.c b/lib/libssl/src/crypto/bio/bio_cb.c index a272bf969a9..133d2b77dc3 100644 --- a/lib/libssl/src/crypto/bio/bio_cb.c +++ b/lib/libssl/src/crypto/bio/bio_cb.c @@ -76,62 +76,62 @@ BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, if (BIO_CB_RETURN & cmd) r = ret; - (void) snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); + snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); p = &(buf[14]); p_maxlen = sizeof buf - 14; switch (cmd) { case BIO_CB_FREE: - (void) snprintf(p, p_maxlen, "Free - %s\n", bio->method->name); + snprintf(p, p_maxlen, "Free - %s\n", bio->method->name); break; case BIO_CB_READ: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "read(%d,%lu) - %s fd=%d\n", bio->num, (unsigned long)argi, bio->method->name, bio->num); else - (void) snprintf(p, p_maxlen, "read(%d,%lu) - %s\n", + snprintf(p, p_maxlen, "read(%d,%lu) - %s\n", bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_WRITE: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "write(%d,%lu) - %s fd=%d\n", bio->num, (unsigned long)argi, bio->method->name, bio->num); else - (void) snprintf(p, p_maxlen, "write(%d,%lu) - %s\n", + snprintf(p, p_maxlen, "write(%d,%lu) - %s\n", bio->num, (unsigned long)argi, bio->method->name); break; case BIO_CB_PUTS: - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "puts() - %s\n", bio->method->name); break; case BIO_CB_GETS: - (void) snprintf(p, p_maxlen, "gets(%lu) - %s\n", + snprintf(p, p_maxlen, "gets(%lu) - %s\n", (unsigned long)argi, bio->method->name); break; case BIO_CB_CTRL: - (void) snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", + snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", (unsigned long)argi, bio->method->name); break; case BIO_CB_RETURN|BIO_CB_READ: - (void) snprintf(p, p_maxlen, "read return %ld\n", ret); + snprintf(p, p_maxlen, "read return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_WRITE: - (void) snprintf(p, p_maxlen, "write return %ld\n", ret); + snprintf(p, p_maxlen, "write return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_GETS: - (void) snprintf(p, p_maxlen, "gets return %ld\n", ret); + snprintf(p, p_maxlen, "gets return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_PUTS: - (void) snprintf(p, p_maxlen, "puts return %ld\n", ret); + snprintf(p, p_maxlen, "puts return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_CTRL: - (void) snprintf(p, p_maxlen, "ctrl return %ld\n", ret); + snprintf(p, p_maxlen, "ctrl return %ld\n", ret); break; default: - (void) snprintf(p, p_maxlen, + snprintf(p, p_maxlen, "bio callback - unknown type (%d)\n", cmd); break; } diff --git a/lib/libssl/src/crypto/bio/bss_conn.c b/lib/libssl/src/crypto/bio/bss_conn.c index fca5d5e853f..45815fd6968 100644 --- a/lib/libssl/src/crypto/bio/bss_conn.c +++ b/lib/libssl/src/crypto/bio/bss_conn.c @@ -482,7 +482,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) char buf[16]; unsigned char *p = ptr; - (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", + snprintf(buf, sizeof buf, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); if (data->param_hostname != NULL) free(data->param_hostname); @@ -491,7 +491,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) } else if (num == 3) { char buf[DECIMAL_SIZE(int) + 1]; - (void) snprintf(buf, sizeof buf, "%d", + snprintf(buf, sizeof buf, "%d", *(int *)ptr); if (data->param_port != NULL) free(data->param_port); diff --git a/lib/libssl/src/crypto/bn/bn_print.c b/lib/libssl/src/crypto/bn/bn_print.c index e2cab2497f6..49efbcb9a9a 100644 --- a/lib/libssl/src/crypto/bn/bn_print.c +++ b/lib/libssl/src/crypto/bn/bn_print.c @@ -147,12 +147,12 @@ char *BN_bn2dec(const BIGNUM *a) /* We now have a series of blocks, BN_DEC_NUM chars * in length, where the last one needs truncation. * The blocks need to be reversed in order. */ - (void) snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp); + snprintf(p,BUF_REMAIN,BN_DEC_FMT1,*lp); while (*p) p++; while (lp != bn_data) { lp--; - (void) snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp); + snprintf(p,BUF_REMAIN,BN_DEC_FMT2,*lp); while (*p) p++; } } @@ -367,10 +367,10 @@ char *BN_options(void) { init++; #ifdef BN_LLONG - (void) snprintf(data,sizeof data,"bn(%d,%d)", + snprintf(data,sizeof data,"bn(%d,%d)", (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); #else - (void) snprintf(data,sizeof data,"bn(%d,%d)", + snprintf(data,sizeof data,"bn(%d,%d)", (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); #endif } diff --git a/lib/libssl/src/crypto/conf/conf_def.c b/lib/libssl/src/crypto/conf/conf_def.c index 26aee50a45e..5ab995a5c00 100644 --- a/lib/libssl/src/crypto/conf/conf_def.c +++ b/lib/libssl/src/crypto/conf/conf_def.c @@ -435,7 +435,7 @@ err: if (buff != NULL) BUF_MEM_free(buff); if (section != NULL) free(section); if (line != NULL) *line=eline; - (void) snprintf(btmp,sizeof btmp,"%ld",eline); + snprintf(btmp,sizeof btmp,"%ld",eline); ERR_add_error_data(2,"line ",btmp); if ((h != conf->data) && (conf->data != NULL)) { diff --git a/lib/libssl/src/crypto/conf/conf_mod.c b/lib/libssl/src/crypto/conf/conf_mod.c index 24170865378..af334518444 100644 --- a/lib/libssl/src/crypto/conf/conf_mod.c +++ b/lib/libssl/src/crypto/conf/conf_mod.c @@ -233,7 +233,7 @@ static int module_run(const CONF *cnf, char *name, char *value, { char rcode[DECIMAL_SIZE(ret)+1]; CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR); - (void) snprintf(rcode, sizeof rcode, "%-8d", ret); + snprintf(rcode, sizeof rcode, "%-8d", ret); ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); } } diff --git a/lib/libssl/src/crypto/cversion.c b/lib/libssl/src/crypto/cversion.c index 7ecfaf9f2fe..326216d0840 100644 --- a/lib/libssl/src/crypto/cversion.c +++ b/lib/libssl/src/crypto/cversion.c @@ -67,7 +67,7 @@ SSLeay_version(int t) #ifdef DATE static char buf[sizeof(DATE) + 11]; - (void) snprintf(buf, sizeof buf, "built on: %s", DATE); + snprintf(buf, sizeof buf, "built on: %s", DATE); return (buf); #else return("built on: date not available"); @@ -77,7 +77,7 @@ SSLeay_version(int t) #ifdef CFLAGS static char buf[sizeof(CFLAGS) + 11]; - (void) snprintf(buf, sizeof buf, "compiler: %s", CFLAGS); + snprintf(buf, sizeof buf, "compiler: %s", CFLAGS); return (buf); #else return("compiler: information not available"); @@ -87,7 +87,7 @@ SSLeay_version(int t) #ifdef PLATFORM static char buf[sizeof(PLATFORM) + 11]; - (void) snprintf(buf, sizeof buf, "platform: %s", PLATFORM); + snprintf(buf, sizeof buf, "platform: %s", PLATFORM); return (buf); #else return("platform: information not available"); diff --git a/lib/libssl/src/crypto/des/ecb_enc.c b/lib/libssl/src/crypto/des/ecb_enc.c index b83fca71db3..f357333b979 100644 --- a/lib/libssl/src/crypto/des/ecb_enc.c +++ b/lib/libssl/src/crypto/des/ecb_enc.c @@ -97,7 +97,7 @@ const char *DES_options(void) size="int"; else size="long"; - (void) snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, + snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, size); init=0; } diff --git a/lib/libssl/src/crypto/engine/eng_padlock.c b/lib/libssl/src/crypto/engine/eng_padlock.c index d5d9a16bf24..a0076851110 100644 --- a/lib/libssl/src/crypto/engine/eng_padlock.c +++ b/lib/libssl/src/crypto/engine/eng_padlock.c @@ -177,7 +177,7 @@ padlock_bind_helper(ENGINE *e) #endif /* Generate a nice engine name with available features */ - (void) snprintf(padlock_name, sizeof(padlock_name), + snprintf(padlock_name, sizeof(padlock_name), "VIA PadLock (%s, %s)", padlock_use_rng ? "RNG" : "no-RNG", padlock_use_ace ? "ACE" : "no-ACE"); diff --git a/lib/libssl/src/crypto/err/err.c b/lib/libssl/src/crypto/err/err.c index 0672477cc87..c4192c6bfa6 100644 --- a/lib/libssl/src/crypto/err/err.c +++ b/lib/libssl/src/crypto/err/err.c @@ -842,13 +842,13 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len) rs=ERR_reason_error_string(e); if (ls == NULL) - (void) snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); + snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); if (fs == NULL) - (void) snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); + snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); if (rs == NULL) - (void) snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); + snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); - (void) snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, + snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, fs?fs:fsbuf, rs?rs:rsbuf); if (strlen(buf) == len-1) { diff --git a/lib/libssl/src/crypto/err/err_prn.c b/lib/libssl/src/crypto/err/err_prn.c index 7374c0abe79..be4d5de2d24 100644 --- a/lib/libssl/src/crypto/err/err_prn.c +++ b/lib/libssl/src/crypto/err/err_prn.c @@ -79,7 +79,7 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) { ERR_error_string_n(l, buf, sizeof buf); - (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, + snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); if (cb(buf2, strlen(buf2), u) <= 0) break; /* abort outputting the error report */ diff --git a/lib/libssl/src/crypto/objects/obj_dat.c b/lib/libssl/src/crypto/objects/obj_dat.c index b3388b117d1..cc007f1206f 100644 --- a/lib/libssl/src/crypto/objects/obj_dat.c +++ b/lib/libssl/src/crypto/objects/obj_dat.c @@ -594,7 +594,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) } else { - (void) snprintf(tbuf,sizeof tbuf,".%lu",l); + snprintf(tbuf,sizeof tbuf,".%lu",l); i=strlen(tbuf); if (buf && (buf_len > 0)) { diff --git a/lib/libssl/src/crypto/pem/pem_pkey.c b/lib/libssl/src/crypto/pem/pem_pkey.c index a3b609b2f36..c8cf00dd879 100644 --- a/lib/libssl/src/crypto/pem/pem_pkey.c +++ b/lib/libssl/src/crypto/pem/pem_pkey.c @@ -147,7 +147,7 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, (char *)kstr, klen, cb, u); - (void) snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str); + snprintf(pem_str, 80, "%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 +199,7 @@ int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) if (!x->ameth || !x->ameth->param_encode) return 0; - (void) snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str); + snprintf(pem_str, 80, "%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/ts/ts_rsp_sign.c b/lib/libssl/src/crypto/ts/ts_rsp_sign.c index e52c9ff03bc..58d58648230 100644 --- a/lib/libssl/src/crypto/ts/ts_rsp_sign.c +++ b/lib/libssl/src/crypto/ts/ts_rsp_sign.c @@ -983,7 +983,7 @@ TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time, if the elements correspond to 0, they MUST be wholly omitted, and the decimal point element also MUST be omitted." */ - (void)snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); + snprintf(usecstr, sizeof(usecstr), ".%06ld", usec); /* truncate and trim trailing 0 */ usecstr[precision + 1] = '\0'; p = usecstr + strlen(usecstr) - 1; diff --git a/lib/libssl/src/crypto/ui/ui_lib.c b/lib/libssl/src/crypto/ui/ui_lib.c index 58e4c5d7221..4138c86d55c 100644 --- a/lib/libssl/src/crypto/ui/ui_lib.c +++ b/lib/libssl/src/crypto/ui/ui_lib.c @@ -844,9 +844,9 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize) + 1]; char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize) + 1]; - (void) snprintf(number1, sizeof(number1), "%d", + snprintf(number1, sizeof(number1), "%d", uis->_.string_data.result_minsize); - (void) snprintf(number2, sizeof(number2), "%d", + snprintf(number2, sizeof(number2), "%d", uis->_.string_data.result_maxsize); if (l < uis->_.string_data.result_minsize) { diff --git a/lib/libssl/src/crypto/x509/by_dir.c b/lib/libssl/src/crypto/x509/by_dir.c index 749323be1e4..ee1838a583a 100644 --- a/lib/libssl/src/crypto/x509/by_dir.c +++ b/lib/libssl/src/crypto/x509/by_dir.c @@ -336,7 +336,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, hent = NULL; } for (;;) { - (void) snprintf(b->data, b->max, "%s/%08lx.%s%d", + snprintf(b->data, b->max, "%s/%08lx.%s%d", ent->dir, h, postfix, k); #ifndef OPENSSL_NO_POSIX_IO diff --git a/lib/libssl/src/crypto/x509/x509_txt.c b/lib/libssl/src/crypto/x509/x509_txt.c index 509948618e1..8caf18a9553 100644 --- a/lib/libssl/src/crypto/x509/x509_txt.c +++ b/lib/libssl/src/crypto/x509/x509_txt.c @@ -184,7 +184,7 @@ const char *X509_verify_cert_error_string(long n) return("CRL path validation error"); default: - (void) snprintf(buf,sizeof buf,"error number %ld",n); + snprintf(buf,sizeof buf,"error number %ld",n); return(buf); } } diff --git a/lib/libssl/src/crypto/x509v3/v3_alt.c b/lib/libssl/src/crypto/x509v3/v3_alt.c index 636677df94a..95b1fa4c975 100644 --- a/lib/libssl/src/crypto/x509v3/v3_alt.c +++ b/lib/libssl/src/crypto/x509v3/v3_alt.c @@ -143,14 +143,14 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, case GEN_IPADD: p = gen->d.ip->data; if(gen->d.ip->length == 4) - (void) snprintf(oline, sizeof oline, + snprintf(oline, sizeof oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); else if(gen->d.ip->length == 16) { oline[0] = 0; for (i = 0; i < 8; i++) { - (void) snprintf(htmp, sizeof htmp, + snprintf(htmp, sizeof htmp, "%X", p[0] << 8 | p[1]); p += 2; strlcat(oline, htmp, sizeof(oline));