diff options
author | ho <> | 2003-04-05 11:05:08 +0000 |
---|---|---|
committer | ho <> | 2003-04-05 11:05:08 +0000 |
commit | d0dbce9d2ce1f0022e91a9d6007272d786be2a60 (patch) | |
tree | 611b2e41c70e7877a4c20ebad4375734738e89c3 | |
parent | a1ab6f619cee593a4d98d863d10af25c6ecf94c4 (diff) | |
download | openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.tar.gz openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.tar.bz2 openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.zip |
Trivial sprintf() -> snprintf() changes. ok deraadt@
26 files changed, 130 insertions, 94 deletions
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index 5d981c6553..58b437bc84 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
@@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
145 | 145 | ||
146 | if((minsize > 0) && (nchar < minsize)) { | 146 | if((minsize > 0) && (nchar < minsize)) { |
147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); | 147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); |
148 | sprintf(strbuf, "%ld", minsize); | 148 | snprintf(strbuf, sizeof strbuf, "%ld", minsize); |
149 | ERR_add_error_data(2, "minsize=", strbuf); | 149 | ERR_add_error_data(2, "minsize=", strbuf); |
150 | return -1; | 150 | return -1; |
151 | } | 151 | } |
152 | 152 | ||
153 | if((maxsize > 0) && (nchar > maxsize)) { | 153 | if((maxsize > 0) && (nchar > maxsize)) { |
154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); | 154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); |
155 | sprintf(strbuf, "%ld", maxsize); | 155 | snprintf(strbuf, sizeof strbuf, "%ld", maxsize); |
156 | ERR_add_error_data(2, "maxsize=", strbuf); | 156 | ERR_add_error_data(2, "maxsize=", strbuf); |
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 0638870ab7..60f36bb958 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -412,8 +412,8 @@ void asn1_add_error(unsigned char *address, int offset) | |||
412 | { | 412 | { |
413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; | 413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; |
414 | 414 | ||
415 | sprintf(buf1,"%lu",(unsigned long)address); | 415 | snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address); |
416 | sprintf(buf2,"%d",offset); | 416 | snprintf(buf2,sizeof buf2,"%d",offset); |
417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c index facfdd27fc..4223c9ae45 100644 --- a/src/lib/libcrypto/asn1/asn1_par.c +++ b/src/lib/libcrypto/asn1/asn1_par.c | |||
@@ -88,11 +88,11 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
88 | 88 | ||
89 | p=str; | 89 | p=str; |
90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) | 90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) |
91 | sprintf(str,"priv [ %d ] ",tag); | 91 | snprintf(str,sizeof str,"priv [ %d ] ",tag); |
92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) | 92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) |
93 | sprintf(str,"cont [ %d ]",tag); | 93 | snprintf(str,sizeof str,"cont [ %d ]",tag); |
94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) | 94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) |
95 | sprintf(str,"appl [ %d ]",tag); | 95 | snprintf(str,sizeof str,"appl [ %d ]",tag); |
96 | else p = ASN1_tag2str(tag); | 96 | else p = ASN1_tag2str(tag); |
97 | 97 | ||
98 | if (p2 != NULL) | 98 | if (p2 != NULL) |
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 739f272ecf..eca97e00cb 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
@@ -116,7 +116,8 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
116 | l=0; | 116 | l=0; |
117 | for (i=0; i<ri->version->length; i++) | 117 | for (i=0; i<ri->version->length; i++) |
118 | { l<<=8; l+=ri->version->data[i]; } | 118 | { l<<=8; l+=ri->version->data[i]; } |
119 | sprintf(str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,l); | 119 | snprintf(str,sizeof str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg, |
120 | l,neg,l); | ||
120 | if (BIO_puts(bp,str) <= 0) goto err; | 121 | if (BIO_puts(bp,str) <= 0) goto err; |
121 | } | 122 | } |
122 | if(!(cflag & X509_FLAG_NO_SUBJECT)) | 123 | if(!(cflag & X509_FLAG_NO_SUBJECT)) |
@@ -168,13 +169,13 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
168 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) | 169 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) |
169 | { | 170 | { |
170 | /* may not be */ | 171 | /* may not be */ |
171 | sprintf(str,"%8sAttributes:\n",""); | 172 | snprintf(str,sizeof str,"%8sAttributes:\n",""); |
172 | if (BIO_puts(bp,str) <= 0) goto err; | 173 | if (BIO_puts(bp,str) <= 0) goto err; |
173 | 174 | ||
174 | sk=x->req_info->attributes; | 175 | sk=x->req_info->attributes; |
175 | if (sk_X509_ATTRIBUTE_num(sk) == 0) | 176 | if (sk_X509_ATTRIBUTE_num(sk) == 0) |
176 | { | 177 | { |
177 | sprintf(str,"%12sa0:00\n",""); | 178 | snprintf(str,sizeof str,"%12sa0:00\n",""); |
178 | if (BIO_puts(bp,str) <= 0) goto err; | 179 | if (BIO_puts(bp,str) <= 0) goto err; |
179 | } | 180 | } |
180 | else | 181 | else |
@@ -190,7 +191,7 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
190 | a=sk_X509_ATTRIBUTE_value(sk,i); | 191 | a=sk_X509_ATTRIBUTE_value(sk,i); |
191 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) | 192 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) |
192 | continue; | 193 | continue; |
193 | sprintf(str,"%12s",""); | 194 | snprintf(str,sizeof str,"%12s",""); |
194 | if (BIO_puts(bp,str) <= 0) goto err; | 195 | if (BIO_puts(bp,str) <= 0) goto err; |
195 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) | 196 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) |
196 | { | 197 | { |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index f91ae4c8c6..81f27dba4c 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -521,8 +521,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
521 | char buf[16]; | 521 | char buf[16]; |
522 | char *p = ptr; | 522 | char *p = ptr; |
523 | 523 | ||
524 | sprintf(buf,"%d.%d.%d.%d", | 524 | snprintf(buf,sizeof buf,"%d.%d.%d.%d", |
525 | p[0],p[1],p[2],p[3]); | 525 | p[0],p[1],p[2],p[3]); |
526 | if (data->param_hostname != NULL) | 526 | if (data->param_hostname != NULL) |
527 | OPENSSL_free(data->param_hostname); | 527 | OPENSSL_free(data->param_hostname); |
528 | data->param_hostname=BUF_strdup(buf); | 528 | data->param_hostname=BUF_strdup(buf); |
@@ -532,7 +532,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
532 | { | 532 | { |
533 | char buf[16]; | 533 | char buf[16]; |
534 | 534 | ||
535 | sprintf(buf,"%d",*(int *)ptr); | 535 | snprintf(buf,sizeof buf,"%d",*(int *)ptr); |
536 | if (data->param_port != NULL) | 536 | if (data->param_port != NULL) |
537 | OPENSSL_free(data->param_port); | 537 | OPENSSL_free(data->param_port); |
538 | data->param_port=BUF_strdup(buf); | 538 | data->param_port=BUF_strdup(buf); |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 8abe095af2..ce2ae78419 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -145,10 +145,10 @@ char *BN_options(void) | |||
145 | { | 145 | { |
146 | init++; | 146 | init++; |
147 | #ifdef BN_LLONG | 147 | #ifdef BN_LLONG |
148 | sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULLONG)*8, | 148 | snprintf(data,sizeof data,"bn(%d,%d)",(int)sizeof(BN_ULLONG)*8, |
149 | (int)sizeof(BN_ULONG)*8); | 149 | (int)sizeof(BN_ULONG)*8); |
150 | #else | 150 | #else |
151 | sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULONG)*8, | 151 | snprintf(data,sizeof data,"bn(%d,%d)",(int)sizeof(BN_ULONG)*8, |
152 | (int)sizeof(BN_ULONG)*8); | 152 | (int)sizeof(BN_ULONG)*8); |
153 | #endif | 153 | #endif |
154 | } | 154 | } |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 37925b603d..48ff6f1120 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
@@ -445,7 +445,7 @@ err: | |||
445 | if (buff != NULL) BUF_MEM_free(buff); | 445 | if (buff != NULL) BUF_MEM_free(buff); |
446 | if (section != NULL) OPENSSL_free(section); | 446 | if (section != NULL) OPENSSL_free(section); |
447 | if (line != NULL) *line=eline; | 447 | if (line != NULL) *line=eline; |
448 | sprintf(btmp,"%ld",eline); | 448 | snprintf(btmp,sizeof btmp,"%ld",eline); |
449 | ERR_add_error_data(2,"line ",btmp); | 449 | ERR_add_error_data(2,"line ",btmp); |
450 | if ((h != conf->data) && (conf->data != NULL)) | 450 | if ((h != conf->data) && (conf->data != NULL)) |
451 | { | 451 | { |
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index 8270ae5eb5..5a747e8c84 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
@@ -232,7 +232,7 @@ static int module_run(const CONF *cnf, char *name, char *value, | |||
232 | { | 232 | { |
233 | char rcode[DECIMAL_SIZE(ret)+1]; | 233 | char rcode[DECIMAL_SIZE(ret)+1]; |
234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); | 234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); |
235 | sprintf(rcode, "%-8d", ret); | 235 | snprintf(rcode, sizeof rcode, "%-8d", ret); |
236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | 236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); |
237 | } | 237 | } |
238 | } | 238 | } |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index 1b70f68806..c828bdd45d 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
@@ -97,7 +97,8 @@ const char *DES_options(void) | |||
97 | size="int"; | 97 | size="int"; |
98 | else | 98 | else |
99 | size="long"; | 99 | size="long"; |
100 | sprintf(buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,size); | 100 | snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, |
101 | size); | ||
101 | init=0; | 102 | init=0; |
102 | } | 103 | } |
103 | return(buf); | 104 | return(buf); |
diff --git a/src/lib/libcrypto/lhash/lh_stats.c b/src/lib/libcrypto/lhash/lh_stats.c index 39ea2885f4..8e6f57c741 100644 --- a/src/lib/libcrypto/lhash/lh_stats.c +++ b/src/lib/libcrypto/lhash/lh_stats.c | |||
@@ -181,46 +181,60 @@ void lh_stats_bio(const LHASH *lh, BIO *out) | |||
181 | { | 181 | { |
182 | char buf[128]; | 182 | char buf[128]; |
183 | 183 | ||
184 | sprintf(buf,"num_items = %lu\n",lh->num_items); | 184 | snprintf(buf,sizeof buf,"num_items = %lu\n",lh->num_items); |
185 | BIO_puts(out,buf); | 185 | BIO_puts(out,buf); |
186 | sprintf(buf,"num_nodes = %u\n",lh->num_nodes); | 186 | snprintf(buf,sizeof buf,"num_nodes = %u\n",lh->num_nodes); |
187 | BIO_puts(out,buf); | 187 | BIO_puts(out,buf); |
188 | sprintf(buf,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); | 188 | snprintf(buf,sizeof buf,"num_alloc_nodes = %u\n", |
189 | lh->num_alloc_nodes); | ||
189 | BIO_puts(out,buf); | 190 | BIO_puts(out,buf); |
190 | sprintf(buf,"num_expands = %lu\n",lh->num_expands); | 191 | snprintf(buf,sizeof buf,"num_expands = %lu\n", |
192 | lh->num_expands); | ||
191 | BIO_puts(out,buf); | 193 | BIO_puts(out,buf); |
192 | sprintf(buf,"num_expand_reallocs = %lu\n",lh->num_expand_reallocs); | 194 | snprintf(buf,sizeof buf,"num_expand_reallocs = %lu\n", |
195 | lh->num_expand_reallocs); | ||
193 | BIO_puts(out,buf); | 196 | BIO_puts(out,buf); |
194 | sprintf(buf,"num_contracts = %lu\n",lh->num_contracts); | 197 | snprintf(buf,sizeof buf,"num_contracts = %lu\n", |
198 | lh->num_contracts); | ||
195 | BIO_puts(out,buf); | 199 | BIO_puts(out,buf); |
196 | sprintf(buf,"num_contract_reallocs = %lu\n",lh->num_contract_reallocs); | 200 | snprintf(buf,sizeof buf,"num_contract_reallocs = %lu\n", |
201 | lh->num_contract_reallocs); | ||
197 | BIO_puts(out,buf); | 202 | BIO_puts(out,buf); |
198 | sprintf(buf,"num_hash_calls = %lu\n",lh->num_hash_calls); | 203 | snprintf(buf,sizeof buf,"num_hash_calls = %lu\n", |
204 | lh->num_hash_calls); | ||
199 | BIO_puts(out,buf); | 205 | BIO_puts(out,buf); |
200 | sprintf(buf,"num_comp_calls = %lu\n",lh->num_comp_calls); | 206 | snprintf(buf,sizeof buf,"num_comp_calls = %lu\n", |
207 | lh->num_comp_calls); | ||
201 | BIO_puts(out,buf); | 208 | BIO_puts(out,buf); |
202 | sprintf(buf,"num_insert = %lu\n",lh->num_insert); | 209 | snprintf(buf,sizeof buf,"num_insert = %lu\n", |
210 | lh->num_insert); | ||
203 | BIO_puts(out,buf); | 211 | BIO_puts(out,buf); |
204 | sprintf(buf,"num_replace = %lu\n",lh->num_replace); | 212 | snprintf(buf,sizeof buf,"num_replace = %lu\n", |
213 | lh->num_replace); | ||
205 | BIO_puts(out,buf); | 214 | BIO_puts(out,buf); |
206 | sprintf(buf,"num_delete = %lu\n",lh->num_delete); | 215 | snprintf(buf,sizeof buf,"num_delete = %lu\n", |
216 | lh->num_delete); | ||
207 | BIO_puts(out,buf); | 217 | BIO_puts(out,buf); |
208 | sprintf(buf,"num_no_delete = %lu\n",lh->num_no_delete); | 218 | snprintf(buf,sizeof buf,"num_no_delete = %lu\n", |
219 | lh->num_no_delete); | ||
209 | BIO_puts(out,buf); | 220 | BIO_puts(out,buf); |
210 | sprintf(buf,"num_retrieve = %lu\n",lh->num_retrieve); | 221 | snprintf(buf,sizeof buf,"num_retrieve = %lu\n", |
222 | lh->num_retrieve); | ||
211 | BIO_puts(out,buf); | 223 | BIO_puts(out,buf); |
212 | sprintf(buf,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); | 224 | snprintf(buf,sizeof buf,"num_retrieve_miss = %lu\n", |
225 | lh->num_retrieve_miss); | ||
213 | BIO_puts(out,buf); | 226 | BIO_puts(out,buf); |
214 | sprintf(buf,"num_hash_comps = %lu\n",lh->num_hash_comps); | 227 | snprintf(buf,sizeof buf,"num_hash_comps = %lu\n", |
228 | lh->num_hash_comps); | ||
215 | BIO_puts(out,buf); | 229 | BIO_puts(out,buf); |
216 | #if 0 | 230 | #if 0 |
217 | sprintf(buf,"p = %u\n",lh->p); | 231 | snprintf(buf,sizeof buf,"p = %u\n",lh->p); |
218 | BIO_puts(out,buf); | 232 | BIO_puts(out,buf); |
219 | sprintf(buf,"pmax = %u\n",lh->pmax); | 233 | snprintf(buf,sizeof buf,"pmax = %u\n",lh->pmax); |
220 | BIO_puts(out,buf); | 234 | BIO_puts(out,buf); |
221 | sprintf(buf,"up_load = %lu\n",lh->up_load); | 235 | snprintf(buf,sizeof buf,"up_load = %lu\n",lh->up_load); |
222 | BIO_puts(out,buf); | 236 | BIO_puts(out,buf); |
223 | sprintf(buf,"down_load = %lu\n",lh->down_load); | 237 | snprintf(buf,sizeof buf,"down_load = %lu\n",lh->down_load); |
224 | BIO_puts(out,buf); | 238 | BIO_puts(out,buf); |
225 | #endif | 239 | #endif |
226 | } | 240 | } |
@@ -235,7 +249,7 @@ void lh_node_stats_bio(const LHASH *lh, BIO *out) | |||
235 | { | 249 | { |
236 | for (n=lh->b[i],num=0; n != NULL; n=n->next) | 250 | for (n=lh->b[i],num=0; n != NULL; n=n->next) |
237 | num++; | 251 | num++; |
238 | sprintf(buf,"node %6u -> %3u\n",i,num); | 252 | snprintf(buf,sizeof buf,"node %6u -> %3u\n",i,num); |
239 | BIO_puts(out,buf); | 253 | BIO_puts(out,buf); |
240 | } | 254 | } |
241 | } | 255 | } |
@@ -258,12 +272,13 @@ void lh_node_usage_stats_bio(const LHASH *lh, BIO *out) | |||
258 | total+=num; | 272 | total+=num; |
259 | } | 273 | } |
260 | } | 274 | } |
261 | sprintf(buf,"%lu nodes used out of %u\n",n_used,lh->num_nodes); | 275 | snprintf(buf,sizeof buf,"%lu nodes used out of %u\n",n_used, |
276 | lh->num_nodes); | ||
262 | BIO_puts(out,buf); | 277 | BIO_puts(out,buf); |
263 | sprintf(buf,"%lu items\n",total); | 278 | snprintf(buf,sizeof buf,"%lu items\n",total); |
264 | BIO_puts(out,buf); | 279 | BIO_puts(out,buf); |
265 | if (n_used == 0) return; | 280 | if (n_used == 0) return; |
266 | sprintf(buf,"load %d.%02d actual load %d.%02d\n", | 281 | snprintf(buf,sizeof buf,"load %d.%02d actual load %d.%02d\n", |
267 | (int)(total/lh->num_nodes), | 282 | (int)(total/lh->num_nodes), |
268 | (int)((total%lh->num_nodes)*100/lh->num_nodes), | 283 | (int)((total%lh->num_nodes)*100/lh->num_nodes), |
269 | (int)(total/n_used), | 284 | (int)(total/n_used), |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index ce779dc1b5..202bd168ac 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
@@ -462,7 +462,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
462 | if (i > 2) i=2; | 462 | if (i > 2) i=2; |
463 | l-=(long)(i*40); | 463 | l-=(long)(i*40); |
464 | 464 | ||
465 | sprintf(tbuf,"%d.%lu",i,l); | 465 | snprintf(tbuf,sizeof tbuf,"%d.%lu",i,l); |
466 | i=strlen(tbuf); | 466 | i=strlen(tbuf); |
467 | strncpy(buf,tbuf,buf_len); | 467 | strncpy(buf,tbuf,buf_len); |
468 | buf_len-=i; | 468 | buf_len-=i; |
@@ -473,7 +473,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
473 | for (; idx<len; idx++) { | 473 | for (; idx<len; idx++) { |
474 | l|=p[idx]&0x7f; | 474 | l|=p[idx]&0x7f; |
475 | if (!(p[idx] & 0x80)) { | 475 | if (!(p[idx] & 0x80)) { |
476 | sprintf(tbuf,".%lu",l); | 476 | snprintf(tbuf,sizeof tbuf,".%lu",l); |
477 | i=strlen(tbuf); | 477 | i=strlen(tbuf); |
478 | if (buf_len > 0) | 478 | if (buf_len > 0) |
479 | strncpy(buf,tbuf,buf_len); | 479 | strncpy(buf,tbuf,buf_len); |
diff --git a/src/lib/libcrypto/x509/x509_txt.c b/src/lib/libcrypto/x509/x509_txt.c index 4f83db8ba2..9d09ae17e8 100644 --- a/src/lib/libcrypto/x509/x509_txt.c +++ b/src/lib/libcrypto/x509/x509_txt.c | |||
@@ -148,7 +148,7 @@ const char *X509_verify_cert_error_string(long n) | |||
148 | return("unhandled critical extension"); | 148 | return("unhandled critical extension"); |
149 | 149 | ||
150 | default: | 150 | default: |
151 | sprintf(buf,"error number %ld",n); | 151 | snprintf(buf,sizeof buf,"error number %ld",n); |
152 | return(buf); | 152 | return(buf); |
153 | } | 153 | } |
154 | } | 154 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c index 0e9e7dcb4f..0fae31a3a6 100644 --- a/src/lib/libcrypto/x509v3/v3_alt.c +++ b/src/lib/libcrypto/x509v3/v3_alt.c | |||
@@ -137,7 +137,8 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, | |||
137 | X509V3_add_value("IP Address","<invalid>", &ret); | 137 | X509V3_add_value("IP Address","<invalid>", &ret); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | sprintf(oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); | 140 | snprintf(oline, sizeof oline, "%d.%d.%d.%d", p[0], p[1], p[2], |
141 | p[3]); | ||
141 | X509V3_add_value("IP Address",oline, &ret); | 142 | X509V3_add_value("IP Address",oline, &ret); |
142 | break; | 143 | break; |
143 | 144 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_mbstr.c b/src/lib/libssl/src/crypto/asn1/a_mbstr.c index 5d981c6553..58b437bc84 100644 --- a/src/lib/libssl/src/crypto/asn1/a_mbstr.c +++ b/src/lib/libssl/src/crypto/asn1/a_mbstr.c | |||
@@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
145 | 145 | ||
146 | if((minsize > 0) && (nchar < minsize)) { | 146 | if((minsize > 0) && (nchar < minsize)) { |
147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); | 147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); |
148 | sprintf(strbuf, "%ld", minsize); | 148 | snprintf(strbuf, sizeof strbuf, "%ld", minsize); |
149 | ERR_add_error_data(2, "minsize=", strbuf); | 149 | ERR_add_error_data(2, "minsize=", strbuf); |
150 | return -1; | 150 | return -1; |
151 | } | 151 | } |
152 | 152 | ||
153 | if((maxsize > 0) && (nchar > maxsize)) { | 153 | if((maxsize > 0) && (nchar > maxsize)) { |
154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); | 154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); |
155 | sprintf(strbuf, "%ld", maxsize); | 155 | snprintf(strbuf, sizeof strbuf, "%ld", maxsize); |
156 | ERR_add_error_data(2, "maxsize=", strbuf); | 156 | ERR_add_error_data(2, "maxsize=", strbuf); |
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_lib.c b/src/lib/libssl/src/crypto/asn1/asn1_lib.c index 0638870ab7..60f36bb958 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_lib.c | |||
@@ -412,8 +412,8 @@ void asn1_add_error(unsigned char *address, int offset) | |||
412 | { | 412 | { |
413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; | 413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; |
414 | 414 | ||
415 | sprintf(buf1,"%lu",(unsigned long)address); | 415 | snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address); |
416 | sprintf(buf2,"%d",offset); | 416 | snprintf(buf2,sizeof buf2,"%d",offset); |
417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_par.c b/src/lib/libssl/src/crypto/asn1/asn1_par.c index facfdd27fc..4223c9ae45 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_par.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_par.c | |||
@@ -88,11 +88,11 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
88 | 88 | ||
89 | p=str; | 89 | p=str; |
90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) | 90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) |
91 | sprintf(str,"priv [ %d ] ",tag); | 91 | snprintf(str,sizeof str,"priv [ %d ] ",tag); |
92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) | 92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) |
93 | sprintf(str,"cont [ %d ]",tag); | 93 | snprintf(str,sizeof str,"cont [ %d ]",tag); |
94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) | 94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) |
95 | sprintf(str,"appl [ %d ]",tag); | 95 | snprintf(str,sizeof str,"appl [ %d ]",tag); |
96 | else p = ASN1_tag2str(tag); | 96 | else p = ASN1_tag2str(tag); |
97 | 97 | ||
98 | if (p2 != NULL) | 98 | if (p2 != NULL) |
diff --git a/src/lib/libssl/src/crypto/asn1/t_req.c b/src/lib/libssl/src/crypto/asn1/t_req.c index 739f272ecf..eca97e00cb 100644 --- a/src/lib/libssl/src/crypto/asn1/t_req.c +++ b/src/lib/libssl/src/crypto/asn1/t_req.c | |||
@@ -116,7 +116,8 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
116 | l=0; | 116 | l=0; |
117 | for (i=0; i<ri->version->length; i++) | 117 | for (i=0; i<ri->version->length; i++) |
118 | { l<<=8; l+=ri->version->data[i]; } | 118 | { l<<=8; l+=ri->version->data[i]; } |
119 | sprintf(str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,l); | 119 | snprintf(str,sizeof str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg, |
120 | l,neg,l); | ||
120 | if (BIO_puts(bp,str) <= 0) goto err; | 121 | if (BIO_puts(bp,str) <= 0) goto err; |
121 | } | 122 | } |
122 | if(!(cflag & X509_FLAG_NO_SUBJECT)) | 123 | if(!(cflag & X509_FLAG_NO_SUBJECT)) |
@@ -168,13 +169,13 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
168 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) | 169 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) |
169 | { | 170 | { |
170 | /* may not be */ | 171 | /* may not be */ |
171 | sprintf(str,"%8sAttributes:\n",""); | 172 | snprintf(str,sizeof str,"%8sAttributes:\n",""); |
172 | if (BIO_puts(bp,str) <= 0) goto err; | 173 | if (BIO_puts(bp,str) <= 0) goto err; |
173 | 174 | ||
174 | sk=x->req_info->attributes; | 175 | sk=x->req_info->attributes; |
175 | if (sk_X509_ATTRIBUTE_num(sk) == 0) | 176 | if (sk_X509_ATTRIBUTE_num(sk) == 0) |
176 | { | 177 | { |
177 | sprintf(str,"%12sa0:00\n",""); | 178 | snprintf(str,sizeof str,"%12sa0:00\n",""); |
178 | if (BIO_puts(bp,str) <= 0) goto err; | 179 | if (BIO_puts(bp,str) <= 0) goto err; |
179 | } | 180 | } |
180 | else | 181 | else |
@@ -190,7 +191,7 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
190 | a=sk_X509_ATTRIBUTE_value(sk,i); | 191 | a=sk_X509_ATTRIBUTE_value(sk,i); |
191 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) | 192 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) |
192 | continue; | 193 | continue; |
193 | sprintf(str,"%12s",""); | 194 | snprintf(str,sizeof str,"%12s",""); |
194 | if (BIO_puts(bp,str) <= 0) goto err; | 195 | if (BIO_puts(bp,str) <= 0) goto err; |
195 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) | 196 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) |
196 | { | 197 | { |
diff --git a/src/lib/libssl/src/crypto/bio/bss_conn.c b/src/lib/libssl/src/crypto/bio/bss_conn.c index f91ae4c8c6..81f27dba4c 100644 --- a/src/lib/libssl/src/crypto/bio/bss_conn.c +++ b/src/lib/libssl/src/crypto/bio/bss_conn.c | |||
@@ -521,8 +521,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
521 | char buf[16]; | 521 | char buf[16]; |
522 | char *p = ptr; | 522 | char *p = ptr; |
523 | 523 | ||
524 | sprintf(buf,"%d.%d.%d.%d", | 524 | snprintf(buf,sizeof buf,"%d.%d.%d.%d", |
525 | p[0],p[1],p[2],p[3]); | 525 | p[0],p[1],p[2],p[3]); |
526 | if (data->param_hostname != NULL) | 526 | if (data->param_hostname != NULL) |
527 | OPENSSL_free(data->param_hostname); | 527 | OPENSSL_free(data->param_hostname); |
528 | data->param_hostname=BUF_strdup(buf); | 528 | data->param_hostname=BUF_strdup(buf); |
@@ -532,7 +532,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
532 | { | 532 | { |
533 | char buf[16]; | 533 | char buf[16]; |
534 | 534 | ||
535 | sprintf(buf,"%d",*(int *)ptr); | 535 | snprintf(buf,sizeof buf,"%d",*(int *)ptr); |
536 | if (data->param_port != NULL) | 536 | if (data->param_port != NULL) |
537 | OPENSSL_free(data->param_port); | 537 | OPENSSL_free(data->param_port); |
538 | data->param_port=BUF_strdup(buf); | 538 | data->param_port=BUF_strdup(buf); |
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c index 8abe095af2..ce2ae78419 100644 --- a/src/lib/libssl/src/crypto/bn/bn_lib.c +++ b/src/lib/libssl/src/crypto/bn/bn_lib.c | |||
@@ -145,10 +145,10 @@ char *BN_options(void) | |||
145 | { | 145 | { |
146 | init++; | 146 | init++; |
147 | #ifdef BN_LLONG | 147 | #ifdef BN_LLONG |
148 | sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULLONG)*8, | 148 | snprintf(data,sizeof data,"bn(%d,%d)",(int)sizeof(BN_ULLONG)*8, |
149 | (int)sizeof(BN_ULONG)*8); | 149 | (int)sizeof(BN_ULONG)*8); |
150 | #else | 150 | #else |
151 | sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULONG)*8, | 151 | snprintf(data,sizeof data,"bn(%d,%d)",(int)sizeof(BN_ULONG)*8, |
152 | (int)sizeof(BN_ULONG)*8); | 152 | (int)sizeof(BN_ULONG)*8); |
153 | #endif | 153 | #endif |
154 | } | 154 | } |
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.c b/src/lib/libssl/src/crypto/conf/conf_def.c index 37925b603d..48ff6f1120 100644 --- a/src/lib/libssl/src/crypto/conf/conf_def.c +++ b/src/lib/libssl/src/crypto/conf/conf_def.c | |||
@@ -445,7 +445,7 @@ err: | |||
445 | if (buff != NULL) BUF_MEM_free(buff); | 445 | if (buff != NULL) BUF_MEM_free(buff); |
446 | if (section != NULL) OPENSSL_free(section); | 446 | if (section != NULL) OPENSSL_free(section); |
447 | if (line != NULL) *line=eline; | 447 | if (line != NULL) *line=eline; |
448 | sprintf(btmp,"%ld",eline); | 448 | snprintf(btmp,sizeof btmp,"%ld",eline); |
449 | ERR_add_error_data(2,"line ",btmp); | 449 | ERR_add_error_data(2,"line ",btmp); |
450 | if ((h != conf->data) && (conf->data != NULL)) | 450 | if ((h != conf->data) && (conf->data != NULL)) |
451 | { | 451 | { |
diff --git a/src/lib/libssl/src/crypto/conf/conf_mod.c b/src/lib/libssl/src/crypto/conf/conf_mod.c index 8270ae5eb5..5a747e8c84 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mod.c +++ b/src/lib/libssl/src/crypto/conf/conf_mod.c | |||
@@ -232,7 +232,7 @@ static int module_run(const CONF *cnf, char *name, char *value, | |||
232 | { | 232 | { |
233 | char rcode[DECIMAL_SIZE(ret)+1]; | 233 | char rcode[DECIMAL_SIZE(ret)+1]; |
234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); | 234 | CONFerr(CONF_F_CONF_MODULES_LOAD, CONF_R_MODULE_INITIALIZATION_ERROR); |
235 | sprintf(rcode, "%-8d", ret); | 235 | snprintf(rcode, sizeof rcode, "%-8d", ret); |
236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | 236 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); |
237 | } | 237 | } |
238 | } | 238 | } |
diff --git a/src/lib/libssl/src/crypto/des/ecb_enc.c b/src/lib/libssl/src/crypto/des/ecb_enc.c index 1b70f68806..c828bdd45d 100644 --- a/src/lib/libssl/src/crypto/des/ecb_enc.c +++ b/src/lib/libssl/src/crypto/des/ecb_enc.c | |||
@@ -97,7 +97,8 @@ const char *DES_options(void) | |||
97 | size="int"; | 97 | size="int"; |
98 | else | 98 | else |
99 | size="long"; | 99 | size="long"; |
100 | sprintf(buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,size); | 100 | snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, |
101 | size); | ||
101 | init=0; | 102 | init=0; |
102 | } | 103 | } |
103 | return(buf); | 104 | return(buf); |
diff --git a/src/lib/libssl/src/crypto/lhash/lh_stats.c b/src/lib/libssl/src/crypto/lhash/lh_stats.c index 39ea2885f4..8e6f57c741 100644 --- a/src/lib/libssl/src/crypto/lhash/lh_stats.c +++ b/src/lib/libssl/src/crypto/lhash/lh_stats.c | |||
@@ -181,46 +181,60 @@ void lh_stats_bio(const LHASH *lh, BIO *out) | |||
181 | { | 181 | { |
182 | char buf[128]; | 182 | char buf[128]; |
183 | 183 | ||
184 | sprintf(buf,"num_items = %lu\n",lh->num_items); | 184 | snprintf(buf,sizeof buf,"num_items = %lu\n",lh->num_items); |
185 | BIO_puts(out,buf); | 185 | BIO_puts(out,buf); |
186 | sprintf(buf,"num_nodes = %u\n",lh->num_nodes); | 186 | snprintf(buf,sizeof buf,"num_nodes = %u\n",lh->num_nodes); |
187 | BIO_puts(out,buf); | 187 | BIO_puts(out,buf); |
188 | sprintf(buf,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); | 188 | snprintf(buf,sizeof buf,"num_alloc_nodes = %u\n", |
189 | lh->num_alloc_nodes); | ||
189 | BIO_puts(out,buf); | 190 | BIO_puts(out,buf); |
190 | sprintf(buf,"num_expands = %lu\n",lh->num_expands); | 191 | snprintf(buf,sizeof buf,"num_expands = %lu\n", |
192 | lh->num_expands); | ||
191 | BIO_puts(out,buf); | 193 | BIO_puts(out,buf); |
192 | sprintf(buf,"num_expand_reallocs = %lu\n",lh->num_expand_reallocs); | 194 | snprintf(buf,sizeof buf,"num_expand_reallocs = %lu\n", |
195 | lh->num_expand_reallocs); | ||
193 | BIO_puts(out,buf); | 196 | BIO_puts(out,buf); |
194 | sprintf(buf,"num_contracts = %lu\n",lh->num_contracts); | 197 | snprintf(buf,sizeof buf,"num_contracts = %lu\n", |
198 | lh->num_contracts); | ||
195 | BIO_puts(out,buf); | 199 | BIO_puts(out,buf); |
196 | sprintf(buf,"num_contract_reallocs = %lu\n",lh->num_contract_reallocs); | 200 | snprintf(buf,sizeof buf,"num_contract_reallocs = %lu\n", |
201 | lh->num_contract_reallocs); | ||
197 | BIO_puts(out,buf); | 202 | BIO_puts(out,buf); |
198 | sprintf(buf,"num_hash_calls = %lu\n",lh->num_hash_calls); | 203 | snprintf(buf,sizeof buf,"num_hash_calls = %lu\n", |
204 | lh->num_hash_calls); | ||
199 | BIO_puts(out,buf); | 205 | BIO_puts(out,buf); |
200 | sprintf(buf,"num_comp_calls = %lu\n",lh->num_comp_calls); | 206 | snprintf(buf,sizeof buf,"num_comp_calls = %lu\n", |
207 | lh->num_comp_calls); | ||
201 | BIO_puts(out,buf); | 208 | BIO_puts(out,buf); |
202 | sprintf(buf,"num_insert = %lu\n",lh->num_insert); | 209 | snprintf(buf,sizeof buf,"num_insert = %lu\n", |
210 | lh->num_insert); | ||
203 | BIO_puts(out,buf); | 211 | BIO_puts(out,buf); |
204 | sprintf(buf,"num_replace = %lu\n",lh->num_replace); | 212 | snprintf(buf,sizeof buf,"num_replace = %lu\n", |
213 | lh->num_replace); | ||
205 | BIO_puts(out,buf); | 214 | BIO_puts(out,buf); |
206 | sprintf(buf,"num_delete = %lu\n",lh->num_delete); | 215 | snprintf(buf,sizeof buf,"num_delete = %lu\n", |
216 | lh->num_delete); | ||
207 | BIO_puts(out,buf); | 217 | BIO_puts(out,buf); |
208 | sprintf(buf,"num_no_delete = %lu\n",lh->num_no_delete); | 218 | snprintf(buf,sizeof buf,"num_no_delete = %lu\n", |
219 | lh->num_no_delete); | ||
209 | BIO_puts(out,buf); | 220 | BIO_puts(out,buf); |
210 | sprintf(buf,"num_retrieve = %lu\n",lh->num_retrieve); | 221 | snprintf(buf,sizeof buf,"num_retrieve = %lu\n", |
222 | lh->num_retrieve); | ||
211 | BIO_puts(out,buf); | 223 | BIO_puts(out,buf); |
212 | sprintf(buf,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); | 224 | snprintf(buf,sizeof buf,"num_retrieve_miss = %lu\n", |
225 | lh->num_retrieve_miss); | ||
213 | BIO_puts(out,buf); | 226 | BIO_puts(out,buf); |
214 | sprintf(buf,"num_hash_comps = %lu\n",lh->num_hash_comps); | 227 | snprintf(buf,sizeof buf,"num_hash_comps = %lu\n", |
228 | lh->num_hash_comps); | ||
215 | BIO_puts(out,buf); | 229 | BIO_puts(out,buf); |
216 | #if 0 | 230 | #if 0 |
217 | sprintf(buf,"p = %u\n",lh->p); | 231 | snprintf(buf,sizeof buf,"p = %u\n",lh->p); |
218 | BIO_puts(out,buf); | 232 | BIO_puts(out,buf); |
219 | sprintf(buf,"pmax = %u\n",lh->pmax); | 233 | snprintf(buf,sizeof buf,"pmax = %u\n",lh->pmax); |
220 | BIO_puts(out,buf); | 234 | BIO_puts(out,buf); |
221 | sprintf(buf,"up_load = %lu\n",lh->up_load); | 235 | snprintf(buf,sizeof buf,"up_load = %lu\n",lh->up_load); |
222 | BIO_puts(out,buf); | 236 | BIO_puts(out,buf); |
223 | sprintf(buf,"down_load = %lu\n",lh->down_load); | 237 | snprintf(buf,sizeof buf,"down_load = %lu\n",lh->down_load); |
224 | BIO_puts(out,buf); | 238 | BIO_puts(out,buf); |
225 | #endif | 239 | #endif |
226 | } | 240 | } |
@@ -235,7 +249,7 @@ void lh_node_stats_bio(const LHASH *lh, BIO *out) | |||
235 | { | 249 | { |
236 | for (n=lh->b[i],num=0; n != NULL; n=n->next) | 250 | for (n=lh->b[i],num=0; n != NULL; n=n->next) |
237 | num++; | 251 | num++; |
238 | sprintf(buf,"node %6u -> %3u\n",i,num); | 252 | snprintf(buf,sizeof buf,"node %6u -> %3u\n",i,num); |
239 | BIO_puts(out,buf); | 253 | BIO_puts(out,buf); |
240 | } | 254 | } |
241 | } | 255 | } |
@@ -258,12 +272,13 @@ void lh_node_usage_stats_bio(const LHASH *lh, BIO *out) | |||
258 | total+=num; | 272 | total+=num; |
259 | } | 273 | } |
260 | } | 274 | } |
261 | sprintf(buf,"%lu nodes used out of %u\n",n_used,lh->num_nodes); | 275 | snprintf(buf,sizeof buf,"%lu nodes used out of %u\n",n_used, |
276 | lh->num_nodes); | ||
262 | BIO_puts(out,buf); | 277 | BIO_puts(out,buf); |
263 | sprintf(buf,"%lu items\n",total); | 278 | snprintf(buf,sizeof buf,"%lu items\n",total); |
264 | BIO_puts(out,buf); | 279 | BIO_puts(out,buf); |
265 | if (n_used == 0) return; | 280 | if (n_used == 0) return; |
266 | sprintf(buf,"load %d.%02d actual load %d.%02d\n", | 281 | snprintf(buf,sizeof buf,"load %d.%02d actual load %d.%02d\n", |
267 | (int)(total/lh->num_nodes), | 282 | (int)(total/lh->num_nodes), |
268 | (int)((total%lh->num_nodes)*100/lh->num_nodes), | 283 | (int)((total%lh->num_nodes)*100/lh->num_nodes), |
269 | (int)(total/n_used), | 284 | (int)(total/n_used), |
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c index ce779dc1b5..202bd168ac 100644 --- a/src/lib/libssl/src/crypto/objects/obj_dat.c +++ b/src/lib/libssl/src/crypto/objects/obj_dat.c | |||
@@ -462,7 +462,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
462 | if (i > 2) i=2; | 462 | if (i > 2) i=2; |
463 | l-=(long)(i*40); | 463 | l-=(long)(i*40); |
464 | 464 | ||
465 | sprintf(tbuf,"%d.%lu",i,l); | 465 | snprintf(tbuf,sizeof tbuf,"%d.%lu",i,l); |
466 | i=strlen(tbuf); | 466 | i=strlen(tbuf); |
467 | strncpy(buf,tbuf,buf_len); | 467 | strncpy(buf,tbuf,buf_len); |
468 | buf_len-=i; | 468 | buf_len-=i; |
@@ -473,7 +473,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
473 | for (; idx<len; idx++) { | 473 | for (; idx<len; idx++) { |
474 | l|=p[idx]&0x7f; | 474 | l|=p[idx]&0x7f; |
475 | if (!(p[idx] & 0x80)) { | 475 | if (!(p[idx] & 0x80)) { |
476 | sprintf(tbuf,".%lu",l); | 476 | snprintf(tbuf,sizeof tbuf,".%lu",l); |
477 | i=strlen(tbuf); | 477 | i=strlen(tbuf); |
478 | if (buf_len > 0) | 478 | if (buf_len > 0) |
479 | strncpy(buf,tbuf,buf_len); | 479 | strncpy(buf,tbuf,buf_len); |
diff --git a/src/lib/libssl/src/crypto/x509/x509_txt.c b/src/lib/libssl/src/crypto/x509/x509_txt.c index 4f83db8ba2..9d09ae17e8 100644 --- a/src/lib/libssl/src/crypto/x509/x509_txt.c +++ b/src/lib/libssl/src/crypto/x509/x509_txt.c | |||
@@ -148,7 +148,7 @@ const char *X509_verify_cert_error_string(long n) | |||
148 | return("unhandled critical extension"); | 148 | return("unhandled critical extension"); |
149 | 149 | ||
150 | default: | 150 | default: |
151 | sprintf(buf,"error number %ld",n); | 151 | snprintf(buf,sizeof buf,"error number %ld",n); |
152 | return(buf); | 152 | return(buf); |
153 | } | 153 | } |
154 | } | 154 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_alt.c b/src/lib/libssl/src/crypto/x509v3/v3_alt.c index 0e9e7dcb4f..0fae31a3a6 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_alt.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_alt.c | |||
@@ -137,7 +137,8 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, | |||
137 | X509V3_add_value("IP Address","<invalid>", &ret); | 137 | X509V3_add_value("IP Address","<invalid>", &ret); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | sprintf(oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); | 140 | snprintf(oline, sizeof oline, "%d.%d.%d.%d", p[0], p[1], p[2], |
141 | p[3]); | ||
141 | X509V3_add_value("IP Address",oline, &ret); | 142 | X509V3_add_value("IP Address",oline, &ret); |
142 | break; | 143 | break; |
143 | 144 | ||