summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
authorguenther <>2014-04-19 11:46:39 +0000
committerguenther <>2014-04-19 11:46:39 +0000
commitf376030ff7fe24f4ad44a56c2d8ba8796c9ab3f0 (patch)
tree1c4f9b095801061d57e575e80f245cef8a59a27f /src/lib/libcrypto/asn1
parent597610ccf04bbca4e88fac7988877d0a06e02211 (diff)
downloadopenbsd-f376030ff7fe24f4ad44a56c2d8ba8796c9ab3f0.tar.gz
openbsd-f376030ff7fe24f4ad44a56c2d8ba8796c9ab3f0.tar.bz2
openbsd-f376030ff7fe24f4ad44a56c2d8ba8796c9ab3f0.zip
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@
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c2
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c4
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c6
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c2
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c8
6 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
index 856aaf0c77..f331bff320 100644
--- a/src/lib/libcrypto/asn1/a_gentm.c
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -244,7 +244,7 @@ ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day,
244 s->data = (unsigned char *)p; 244 s->data = (unsigned char *)p;
245 } 245 }
246 246
247 (void) snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ", ts->tm_year + 1900, 247 snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ", ts->tm_year + 1900,
248 ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec); 248 ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec);
249 s->length = strlen(p); 249 s->length = strlen(p);
250 s->type = V_ASN1_GENERALIZEDTIME; 250 s->type = V_ASN1_GENERALIZEDTIME;
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index 5a909d6ae2..6528161c41 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -150,14 +150,14 @@ ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
150 150
151 if ((minsize > 0) && (nchar < minsize)) { 151 if ((minsize > 0) && (nchar < minsize)) {
152 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); 152 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
153 (void) snprintf(strbuf, sizeof strbuf, "%ld", minsize); 153 snprintf(strbuf, sizeof strbuf, "%ld", minsize);
154 ERR_add_error_data(2, "minsize=", strbuf); 154 ERR_add_error_data(2, "minsize=", strbuf);
155 return -1; 155 return -1;
156 } 156 }
157 157
158 if ((maxsize > 0) && (nchar > maxsize)) { 158 if ((maxsize > 0) && (nchar > maxsize)) {
159 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); 159 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG);
160 (void) snprintf(strbuf, sizeof strbuf, "%ld", maxsize); 160 snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
161 ERR_add_error_data(2, "maxsize=", strbuf); 161 ERR_add_error_data(2, "maxsize=", strbuf);
162 return -1; 162 return -1;
163 } 163 }
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index 7dc531a2d8..e92c166303 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/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
125 if(c > 0xffffffffL) 125 if(c > 0xffffffffL)
126 return -1; 126 return -1;
127 if(c > 0xffff) { 127 if(c > 0xffff) {
128 (void) snprintf(tmphex, sizeof tmphex, "\\W%08lX", c); 128 snprintf(tmphex, sizeof tmphex, "\\W%08lX", c);
129 if(!io_ch(arg, tmphex, 10)) return -1; 129 if(!io_ch(arg, tmphex, 10)) return -1;
130 return 10; 130 return 10;
131 } 131 }
132 if(c > 0xff) { 132 if(c > 0xff) {
133 (void) snprintf(tmphex, sizeof tmphex, "\\U%04lX", c); 133 snprintf(tmphex, sizeof tmphex, "\\U%04lX", c);
134 if(!io_ch(arg, tmphex, 6)) return -1; 134 if(!io_ch(arg, tmphex, 6)) return -1;
135 return 6; 135 return 6;
136 } 136 }
@@ -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, sizeof tmphex, "\\%02X", chtmp); 152 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/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index a2325f2525..0120b952b3 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -205,7 +205,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
205 s->data=(unsigned char *)p; 205 s->data=(unsigned char *)p;
206 } 206 }
207 207
208 (void) snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, 208 snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
209 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 209 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
210 s->length=strlen(p); 210 s->length=strlen(p);
211 s->type=V_ASN1_UTCTIME; 211 s->type=V_ASN1_UTCTIME;
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index 49d650b125..86cfdd3967 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -467,8 +467,8 @@ asn1_add_error(const unsigned char *address, int offset)
467{ 467{
468 char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1]; 468 char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1];
469 469
470 (void) snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address); 470 snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address);
471 (void) snprintf(buf2, sizeof buf2, "%d", offset); 471 snprintf(buf2, sizeof buf2, "%d", offset);
472 ERR_add_error_data(4, "address=", buf1, " offset=", buf2); 472 ERR_add_error_data(4, "address=", buf1, " offset=", buf2);
473} 473}
474 474
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index 064b3dcb22..8085d1e570 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -85,13 +85,13 @@ asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
85 85
86 p = str; 86 p = str;
87 if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) 87 if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
88 (void) snprintf(str, sizeof str, "priv [ %d ] ", tag); 88 snprintf(str, sizeof str, "priv [ %d ] ", tag);
89 else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) 89 else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
90 (void) snprintf(str, sizeof str, "cont [ %d ]", tag); 90 snprintf(str, sizeof str, "cont [ %d ]", tag);
91 else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) 91 else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
92 (void) snprintf(str, sizeof str, "appl [ %d ]", tag); 92 snprintf(str, sizeof str, "appl [ %d ]", tag);
93 else if (tag > 30) 93 else if (tag > 30)
94 (void) snprintf(str, sizeof str, "<ASN1 %d>", tag); 94 snprintf(str, sizeof str, "<ASN1 %d>", tag);
95 else 95 else
96 p = ASN1_tag2str(tag); 96 p = ASN1_tag2str(tag);
97 97