diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2004-04-08 08:03:16 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2004-04-08 08:03:16 +0000 |
commit | 5a78afb796c71a4c40ab9143bb17ca9cbeb0fd13 (patch) | |
tree | 798b4df03722b6dbd2be5083e0b5a7e189c24c25 /lib/libcrypto/bio | |
parent | 7f2dfee3469d0814057ac4a8e518f5ed7ccc34b9 (diff) |
merge 0.9.7d
Diffstat (limited to 'lib/libcrypto/bio')
-rw-r--r-- | lib/libcrypto/bio/b_dump.c | 24 | ||||
-rw-r--r-- | lib/libcrypto/bio/b_print.c | 12 | ||||
-rw-r--r-- | lib/libcrypto/bio/b_sock.c | 12 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio_cb.c | 30 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_conn.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_file.c | 10 |
6 files changed, 47 insertions, 47 deletions
diff --git a/lib/libcrypto/bio/b_dump.c b/lib/libcrypto/bio/b_dump.c index 983604fb494..f671e722fa3 100644 --- a/lib/libcrypto/bio/b_dump.c +++ b/lib/libcrypto/bio/b_dump.c @@ -104,41 +104,41 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) for(i=0;i<rows;i++) { buf[0]='\0'; /* start with empty string */ - strlcpy(buf,str,sizeof buf); - snprintf(tmp,sizeof tmp,"%04x - ",i*dump_width); - strlcat(buf,tmp,sizeof buf); + BUF_strlcpy(buf,str,sizeof buf); + BIO_snprintf(tmp,sizeof tmp,"%04x - ",i*dump_width); + BUF_strlcat(buf,tmp,sizeof buf); for(j=0;j<dump_width;j++) { if (((i*dump_width)+j)>=len) { - strlcat(buf," ",sizeof buf); + BUF_strlcat(buf," ",sizeof buf); } else { ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; - snprintf(tmp,sizeof tmp,"%02x%c",ch, + BIO_snprintf(tmp,sizeof tmp,"%02x%c",ch, j==7?'-':' '); - strlcat(buf,tmp,sizeof buf); + BUF_strlcat(buf,tmp,sizeof buf); } } - strlcat(buf," ",sizeof buf); + BUF_strlcat(buf," ",sizeof buf); for(j=0;j<dump_width;j++) { if (((i*dump_width)+j)>=len) break; ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; #ifndef CHARSET_EBCDIC - snprintf(tmp,sizeof tmp,"%c", + BIO_snprintf(tmp,sizeof tmp,"%c", ((ch>=' ')&&(ch<='~'))?ch:'.'); #else - snprintf(tmp,sizeof tmp,"%c", + BIO_snprintf(tmp,sizeof tmp,"%c", ((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) ? os_toebcdic[ch] : '.'); #endif - strlcat(buf,tmp,sizeof buf); + BUF_strlcat(buf,tmp,sizeof buf); } - strlcat(buf,"\n",sizeof buf); + BUF_strlcat(buf,"\n",sizeof buf); /* if this is the last call then update the ddt_dump thing so that * we will move the selection point in the debug window */ @@ -147,7 +147,7 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) #ifdef TRUNCATE if (trunc > 0) { - snprintf(buf,sizeof buf,"%s%04x - <SPACES/NULS>\n",str, + BIO_snprintf(buf,sizeof buf,"%s%04x - <SPACES/NULS>\n",str, len+trunc); ret+=BIO_write(bio,(char *)buf,strlen(buf)); } diff --git a/lib/libcrypto/bio/b_print.c b/lib/libcrypto/bio/b_print.c index 2cfc689dd6b..fbff3317968 100644 --- a/lib/libcrypto/bio/b_print.c +++ b/lib/libcrypto/bio/b_print.c @@ -576,12 +576,12 @@ abs_val(LDOUBLE value) } static LDOUBLE -pow10(int exp) +pow10(int in_exp) { LDOUBLE result = 1; - while (exp) { + while (in_exp) { result *= 10; - exp--; + in_exp--; } return result; } @@ -652,8 +652,8 @@ fmtfp( (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10]; intpart = (intpart / 10); - } while (intpart && (iplace < sizeof iplace)); - if (iplace == sizeof iplace) + } while (intpart && (iplace < sizeof iconvert)); + if (iplace == sizeof iconvert) iplace--; iconvert[iplace] = 0; @@ -664,7 +664,7 @@ fmtfp( : "0123456789abcdef")[fracpart % 10]; fracpart = (fracpart / 10); } while (fplace < max); - if (fplace == sizeof fplace) + if (fplace == sizeof fconvert) fplace--; fconvert[fplace] = 0; diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index 5282f8a8f76..c851298d1e6 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -709,12 +709,12 @@ int BIO_accept(int sock, char **addr) } *addr=p; } - 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); + BIO_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); end: return(ret); } diff --git a/lib/libcrypto/bio/bio_cb.c b/lib/libcrypto/bio/bio_cb.c index ee9159ebd8f..6f4254a1141 100644 --- a/lib/libcrypto/bio/bio_cb.c +++ b/lib/libcrypto/bio/bio_cb.c @@ -75,56 +75,56 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, if (BIO_CB_RETURN & cmd) r=ret; - snprintf(buf,sizeof buf,"BIO[%08lX]:",(unsigned long)bio); + BIO_snprintf(buf,sizeof buf,"BIO[%08lX]:",(unsigned long)bio); p= &(buf[14]); p_maxlen = sizeof buf - 14; switch (cmd) { case BIO_CB_FREE: - snprintf(p,p_maxlen,"Free - %s\n",bio->method->name); + BIO_snprintf(p,p_maxlen,"Free - %s\n",bio->method->name); break; case BIO_CB_READ: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - snprintf(p,p_maxlen,"read(%d,%d) - %s fd=%d\n", + BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s fd=%d\n", bio->num,argi,bio->method->name,bio->num); else - snprintf(p,p_maxlen,"read(%d,%d) - %s\n", + BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s\n", bio->num,argi,bio->method->name); break; case BIO_CB_WRITE: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - snprintf(p,p_maxlen,"write(%d,%d) - %s fd=%d\n", + BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s fd=%d\n", bio->num,argi,bio->method->name,bio->num); else - snprintf(p,p_maxlen,"write(%d,%d) - %s\n", + BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s\n", bio->num,argi,bio->method->name); break; case BIO_CB_PUTS: - snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); + BIO_snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); break; case BIO_CB_GETS: - snprintf(p,p_maxlen,"gets(%d) - %s\n",argi,bio->method->name); + BIO_snprintf(p,p_maxlen,"gets(%d) - %s\n",argi,bio->method->name); break; case BIO_CB_CTRL: - snprintf(p,p_maxlen,"ctrl(%d) - %s\n",argi,bio->method->name); + BIO_snprintf(p,p_maxlen,"ctrl(%d) - %s\n",argi,bio->method->name); break; case BIO_CB_RETURN|BIO_CB_READ: - snprintf(p,p_maxlen,"read return %ld\n",ret); + BIO_snprintf(p,p_maxlen,"read return %ld\n",ret); break; case BIO_CB_RETURN|BIO_CB_WRITE: - snprintf(p,p_maxlen,"write return %ld\n",ret); + BIO_snprintf(p,p_maxlen,"write return %ld\n",ret); break; case BIO_CB_RETURN|BIO_CB_GETS: - snprintf(p,p_maxlen,"gets return %ld\n",ret); + BIO_snprintf(p,p_maxlen,"gets return %ld\n",ret); break; case BIO_CB_RETURN|BIO_CB_PUTS: - snprintf(p,p_maxlen,"puts return %ld\n",ret); + BIO_snprintf(p,p_maxlen,"puts return %ld\n",ret); break; case BIO_CB_RETURN|BIO_CB_CTRL: - snprintf(p,p_maxlen,"ctrl return %ld\n",ret); + BIO_snprintf(p,p_maxlen,"ctrl return %ld\n",ret); break; default: - snprintf(p,p_maxlen,"bio callback - unknown type (%d)\n",cmd); + BIO_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 8c694140ed4..f5d0e759e23 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -521,8 +521,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) char buf[16]; unsigned char *p = ptr; - snprintf(buf,sizeof buf,"%d.%d.%d.%d", - p[0],p[1],p[2],p[3]); + BIO_snprintf(buf,sizeof buf,"%d.%d.%d.%d", + p[0],p[1],p[2],p[3]); if (data->param_hostname != NULL) OPENSSL_free(data->param_hostname); data->param_hostname=BUF_strdup(buf); @@ -532,7 +532,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) { char buf[DECIMAL_SIZE(int)+1]; - snprintf(buf,sizeof buf,"%d",*(int *)ptr); + BIO_snprintf(buf,sizeof buf,"%d",*(int *)ptr); if (data->param_port != NULL) OPENSSL_free(data->param_port); data->param_port=BUF_strdup(buf); diff --git a/lib/libcrypto/bio/bss_file.c b/lib/libcrypto/bio/bss_file.c index 0ca603ee0a5..9cdf159f82f 100644 --- a/lib/libcrypto/bio/bss_file.c +++ b/lib/libcrypto/bio/bss_file.c @@ -249,15 +249,15 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) if (num & BIO_FP_APPEND) { if (num & BIO_FP_READ) - strlcpy(p,"a+",sizeof p); - else strlcpy(p,"a",sizeof p); + BUF_strlcpy(p,"a+",sizeof p); + else BUF_strlcpy(p,"a",sizeof p); } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) - strlcpy(p,"r+",sizeof p); + BUF_strlcpy(p,"r+",sizeof p); else if (num & BIO_FP_WRITE) - strlcpy(p,"w",sizeof p); + BUF_strlcpy(p,"w",sizeof p); else if (num & BIO_FP_READ) - strlcpy(p,"r",sizeof p); + BUF_strlcpy(p,"r",sizeof p); else { BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE); |