From 143cedbbb5931c72fe516e48392a9203fe83567d Mon Sep 17 00:00:00 2001 From: beck Date: Sat, 19 Apr 2014 00:41:37 +0000 Subject: [PATCH] use intrinsic strlcpy and strlcat everywhere so we only have one set of funcitons to check for incorrect use. keep BUF_strlcpy and BUF_strlcat for API comptibility only. ok tedu@ --- lib/libcrypto/asn1/a_time.c | 6 +++--- lib/libcrypto/bio/b_dump.c | 14 +++++++------- lib/libcrypto/bio/bss_file.c | 10 +++++----- lib/libcrypto/conf/conf_def.c | 4 ++-- lib/libcrypto/dso/dso_lib.c | 4 ++-- lib/libcrypto/err/err.c | 2 +- lib/libcrypto/evp/evp_pbe.c | 2 +- lib/libcrypto/objects/obj_dat.c | 6 +++--- lib/libcrypto/pem/pem_lib.c | 12 ++++++------ lib/libcrypto/rand/randfile.c | 2 +- lib/libcrypto/ui/ui_lib.c | 12 ++++++------ lib/libcrypto/x509v3/v3_info.c | 6 +++--- lib/libssl/src/apps/apps.c | 4 ++-- lib/libssl/src/apps/ca.c | 16 ++++++++-------- lib/libssl/src/apps/engine.c | 4 ++-- lib/libssl/src/apps/pkcs12.c | 4 ++-- lib/libssl/src/apps/req.c | 16 ++++++++-------- lib/libssl/src/apps/s_socket.c | 2 +- lib/libssl/src/apps/x509.c | 6 +++--- lib/libssl/src/crypto/asn1/a_time.c | 6 +++--- lib/libssl/src/crypto/bio/b_dump.c | 14 +++++++------- lib/libssl/src/crypto/bio/bss_file.c | 10 +++++----- lib/libssl/src/crypto/conf/conf_def.c | 4 ++-- lib/libssl/src/crypto/dso/dso_lib.c | 4 ++-- lib/libssl/src/crypto/err/err.c | 2 +- lib/libssl/src/crypto/evp/evp_pbe.c | 2 +- lib/libssl/src/crypto/objects/obj_dat.c | 6 +++--- lib/libssl/src/crypto/pem/pem_lib.c | 12 ++++++------ lib/libssl/src/crypto/rand/randfile.c | 2 +- lib/libssl/src/crypto/ui/ui_lib.c | 12 ++++++------ lib/libssl/src/crypto/x509v3/v3_info.c | 6 +++--- 31 files changed, 106 insertions(+), 106 deletions(-) diff --git a/lib/libcrypto/asn1/a_time.c b/lib/libcrypto/asn1/a_time.c index f3f28369f41..1978e8d3dcf 100644 --- a/lib/libcrypto/asn1/a_time.c +++ b/lib/libcrypto/asn1/a_time.c @@ -147,10 +147,10 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE newlen = t->length + 2 + 1; str = (char *)ret->data; /* Work out the century and prepend */ - if (t->data[0] >= '5') BUF_strlcpy(str, "19", newlen); - else BUF_strlcpy(str, "20", newlen); + if (t->data[0] >= '5') strlcpy(str, "19", newlen); + else strlcpy(str, "20", newlen); - BUF_strlcat(str, (char *)t->data, newlen); + strlcat(str, (char *)t->data, newlen); return ret; } diff --git a/lib/libcrypto/bio/b_dump.c b/lib/libcrypto/bio/b_dump.c index ff75069df86..61c9fe20a3a 100644 --- a/lib/libcrypto/bio/b_dump.c +++ b/lib/libcrypto/bio/b_dump.c @@ -107,29 +107,29 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), rows++; for (i = 0; i < rows; i++) { buf[0] = '\0'; /* start with empty string */ - BUF_strlcpy(buf, str, sizeof buf); + strlcpy(buf, str, sizeof buf); (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); for (j = 0; j < dump_width; j++) { if (((i*dump_width) + j) >= len) { - BUF_strlcat(buf, " ", sizeof buf); + strlcat(buf, " ", sizeof buf); } else { ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, j == 7 ? '-' : ' '); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); } } - BUF_strlcat(buf, " ", sizeof 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; (void) snprintf(tmp, sizeof tmp, "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); } - BUF_strlcat(buf, "\n", sizeof 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 */ diff --git a/lib/libcrypto/bio/bss_file.c b/lib/libcrypto/bio/bss_file.c index 995c6233411..acc746260ed 100644 --- a/lib/libcrypto/bio/bss_file.c +++ b/lib/libcrypto/bio/bss_file.c @@ -246,14 +246,14 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) b->shutdown = (int)num&BIO_CLOSE; if (num & BIO_FP_APPEND) { if (num & BIO_FP_READ) - BUF_strlcpy(p, "a+", sizeof p); - else BUF_strlcpy(p, "a", sizeof p); + strlcpy(p, "a+", sizeof p); + else strlcpy(p, "a", sizeof p); } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) - BUF_strlcpy(p, "r+", sizeof p); + strlcpy(p, "r+", sizeof p); else if (num & BIO_FP_WRITE) - BUF_strlcpy(p, "w", sizeof p); + strlcpy(p, "w", sizeof p); else if (num & BIO_FP_READ) - BUF_strlcpy(p, "r", sizeof p); + strlcpy(p, "r", sizeof p); else { BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE); ret = 0; diff --git a/lib/libcrypto/conf/conf_def.c b/lib/libcrypto/conf/conf_def.c index 39e8b8e5210..26aee50a45e 100644 --- a/lib/libcrypto/conf/conf_def.c +++ b/lib/libcrypto/conf/conf_def.c @@ -230,7 +230,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); goto err; } - BUF_strlcpy(section,"default",10); + strlcpy(section,"default",10); if (_CONF_new_data(conf) == 0) { @@ -384,7 +384,7 @@ again: ERR_R_MALLOC_FAILURE); goto err; } - BUF_strlcpy(v->name,pname,strlen(pname)+1); + strlcpy(v->name,pname,strlen(pname)+1); if (!str_copy(conf,psection,&(v->value),start)) goto err; if (strcmp(psection,section) != 0) diff --git a/lib/libcrypto/dso/dso_lib.c b/lib/libcrypto/dso/dso_lib.c index 00e65938b91..2f77242d475 100644 --- a/lib/libcrypto/dso/dso_lib.c +++ b/lib/libcrypto/dso/dso_lib.c @@ -373,7 +373,7 @@ int DSO_set_filename(DSO *dso, const char *filename) DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); return(0); } - BUF_strlcpy(copied, filename, strlen(filename) + 1); + strlcpy(copied, filename, strlen(filename) + 1); if(dso->filename) free(dso->filename); dso->filename = copied; @@ -432,7 +432,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) ERR_R_MALLOC_FAILURE); return(NULL); } - BUF_strlcpy(result, filename, strlen(filename) + 1); + strlcpy(result, filename, strlen(filename) + 1); } return(result); } diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index 27a19bc52c9..0672477cc87 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1071,7 +1071,7 @@ void ERR_add_error_vdata(int num, va_list args) else str=p; } - BUF_strlcat(str,a,(size_t)s+1); + strlcat(str,a,(size_t)s+1); } } ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); diff --git a/lib/libcrypto/evp/evp_pbe.c b/lib/libcrypto/evp/evp_pbe.c index c808b96fef8..37a926c3fcf 100644 --- a/lib/libcrypto/evp/evp_pbe.c +++ b/lib/libcrypto/evp/evp_pbe.c @@ -165,7 +165,7 @@ int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, { char obj_tmp[80]; EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); - if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); + if (!pbe_obj) strlcpy (obj_tmp, "NULL", sizeof obj_tmp); else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj); ERR_add_error_data(2, "TYPE=", obj_tmp); return 0; diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index cf4db7c6b5c..b3388b117d1 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -486,7 +486,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) if (s) { if (buf) - BUF_strlcpy(buf,s,buf_len); + strlcpy(buf,s,buf_len); n=strlen(s); return n; } @@ -576,7 +576,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) *buf++ = '.'; buf_len--; } - BUF_strlcpy(buf,bndec,buf_len); + strlcpy(buf,bndec,buf_len); if (i > buf_len) { buf += buf_len; @@ -598,7 +598,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) i=strlen(tbuf); if (buf && (buf_len > 0)) { - BUF_strlcpy(buf,tbuf,buf_len); + strlcpy(buf,tbuf,buf_len); if (i > buf_len) { buf += buf_len; diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c index aa6a4c93870..93736455fa9 100644 --- a/lib/libcrypto/pem/pem_lib.c +++ b/lib/libcrypto/pem/pem_lib.c @@ -137,9 +137,9 @@ void PEM_proc_type(char *buf, int type) else str="BAD-TYPE"; - BUF_strlcat(buf,"Proc-Type: 4,",PEM_BUFSIZE); - BUF_strlcat(buf,str,PEM_BUFSIZE); - BUF_strlcat(buf,"\n",PEM_BUFSIZE); + strlcat(buf,"Proc-Type: 4,",PEM_BUFSIZE); + strlcat(buf,str,PEM_BUFSIZE); + strlcat(buf,"\n",PEM_BUFSIZE); } void PEM_dek_info(char *buf, const char *type, int len, char *str) @@ -148,9 +148,9 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str) long i; int j; - BUF_strlcat(buf,"DEK-Info: ",PEM_BUFSIZE); - BUF_strlcat(buf,type,PEM_BUFSIZE); - BUF_strlcat(buf,",",PEM_BUFSIZE); + strlcat(buf,"DEK-Info: ",PEM_BUFSIZE); + strlcat(buf,type,PEM_BUFSIZE); + strlcat(buf,",",PEM_BUFSIZE); j=strlen(buf); if (j + (len * 2) + 1 > PEM_BUFSIZE) return; diff --git a/lib/libcrypto/rand/randfile.c b/lib/libcrypto/rand/randfile.c index 25258046680..5326f710c5e 100644 --- a/lib/libcrypto/rand/randfile.c +++ b/lib/libcrypto/rand/randfile.c @@ -142,7 +142,7 @@ err: const char *RAND_file_name(char *buf, size_t size) { - if (BUF_strlcpy(buf,"/dev/urandom",size) >= size) + if (strlcpy(buf,"/dev/urandom",size) >= size) return(NULL); return buf; } diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c index fc03d9b7d4c..58e4c5d7221 100644 --- a/lib/libcrypto/ui/ui_lib.c +++ b/lib/libcrypto/ui/ui_lib.c @@ -409,13 +409,13 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) len += sizeof(prompt3) - 1; prompt = (char *)malloc(len + 1); - BUF_strlcpy(prompt, prompt1, len + 1); - BUF_strlcat(prompt, object_desc, len + 1); + strlcpy(prompt, prompt1, len + 1); + strlcat(prompt, object_desc, len + 1); if (object_name) { - BUF_strlcat(prompt, prompt2, len + 1); - BUF_strlcat(prompt, object_name, len + 1); + strlcat(prompt, prompt2, len + 1); + strlcat(prompt, object_name, len + 1); } - BUF_strlcat(prompt, prompt3, len + 1); + strlcat(prompt, prompt3, len + 1); } return prompt; } @@ -869,7 +869,7 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) UIerr(UI_F_UI_SET_RESULT, UI_R_NO_RESULT_BUFFER); return -1; } - BUF_strlcpy(uis->result_buf, result, + strlcpy(uis->result_buf, result, uis->_.string_data.result_maxsize + 1); break; case UIT_BOOLEAN: diff --git a/lib/libcrypto/x509v3/v3_info.c b/lib/libcrypto/x509v3/v3_info.c index 2b290ca00c8..c9d6c97b513 100644 --- a/lib/libcrypto/x509v3/v3_info.c +++ b/lib/libcrypto/x509v3/v3_info.c @@ -121,9 +121,9 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method ERR_R_MALLOC_FAILURE); return NULL; } - BUF_strlcpy(ntmp, objtmp, nlen); - BUF_strlcat(ntmp, " - ", nlen); - BUF_strlcat(ntmp, vtmp->name, nlen); + strlcpy(ntmp, objtmp, nlen); + strlcat(ntmp, " - ", nlen); + strlcat(ntmp, vtmp->name, nlen); free(vtmp->name); vtmp->name = ntmp; diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c index 446bb4d17ce..4a8be9993df 100644 --- a/lib/libssl/src/apps/apps.c +++ b/lib/libssl/src/apps/apps.c @@ -198,7 +198,7 @@ program_name(char *in, char *out, int size) p++; else p = in; - BUF_strlcpy(out, p, size); + strlcpy(out, p, size); } int @@ -1447,7 +1447,7 @@ save_serial(char *serialfile, char *suffix, BIGNUM * serial, goto err; } if (suffix == NULL) - BUF_strlcpy(buf[0], serialfile, BSIZE); + strlcpy(buf[0], serialfile, BSIZE); else (void) snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix); #ifdef RL_DEBUG diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c index c582549b15b..3f2d10671c0 100644 --- a/lib/libssl/src/apps/ca.c +++ b/lib/libssl/src/apps/ca.c @@ -1136,7 +1136,7 @@ ca_main(int argc, char **argv) } strlcpy(buf[2], outdir, sizeof(buf[2])); - BUF_strlcat(buf[2], "/", sizeof(buf[2])); + strlcat(buf[2], "/", sizeof(buf[2])); n = (char *) &(buf[2][strlen(buf[2])]); if (j > 0) { @@ -1955,7 +1955,7 @@ do_body(X509 ** xret, EVP_PKEY * pkey, X509 * x509, const EVP_MD * dgst, BIO_printf(bio_err, "Memory allocation failure\n"); goto err; } - BUF_strlcpy(row[DB_file], "unknown", 8); + strlcpy(row[DB_file], "unknown", 8); row[DB_type][0] = 'V'; row[DB_type][1] = '\0'; @@ -2211,7 +2211,7 @@ do_revoke(X509 * x509, CA_DB * db, int type, char *value) BIO_printf(bio_err, "Memory allocation failure\n"); goto err; } - BUF_strlcpy(row[DB_file], "unknown", 8); + strlcpy(row[DB_file], "unknown", 8); row[DB_type][0] = 'V'; row[DB_type][1] = '\0'; @@ -2497,14 +2497,14 @@ make_revocation_str(int rev_type, char *rev_arg) if (!str) return NULL; - BUF_strlcpy(str, (char *) revtm->data, i); + strlcpy(str, (char *) revtm->data, i); if (reason) { - BUF_strlcat(str, ",", i); - BUF_strlcat(str, reason, i); + strlcat(str, ",", i); + strlcat(str, reason, i); } if (other) { - BUF_strlcat(str, ",", i); - BUF_strlcat(str, other, i); + strlcat(str, ",", i); + strlcat(str, other, i); } ASN1_UTCTIME_free(revtm); return str; diff --git a/lib/libssl/src/apps/engine.c b/lib/libssl/src/apps/engine.c index 5ed33d0d399..7898c96f23d 100644 --- a/lib/libssl/src/apps/engine.c +++ b/lib/libssl/src/apps/engine.c @@ -119,8 +119,8 @@ append_buf(char **buf, const char *s, int *size, int step) return 0; if (**buf != '\0') - BUF_strlcat(*buf, ", ", *size); - BUF_strlcat(*buf, s, *size); + strlcat(*buf, ", ", *size); + strlcat(*buf, s, *size); return 1; } diff --git a/lib/libssl/src/apps/pkcs12.c b/lib/libssl/src/apps/pkcs12.c index 933fded99ad..44ee6986054 100644 --- a/lib/libssl/src/apps/pkcs12.c +++ b/lib/libssl/src/apps/pkcs12.c @@ -592,7 +592,7 @@ pkcs12_main(int argc, char **argv) goto export_end; } if (!twopass) - BUF_strlcpy(macpass, pass, sizeof macpass); + strlcpy(macpass, pass, sizeof macpass); #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); @@ -661,7 +661,7 @@ export_end: #endif if (!twopass) - BUF_strlcpy(macpass, pass, sizeof macpass); + strlcpy(macpass, pass, sizeof macpass); if ((options & INFO) && p12->mac) BIO_printf(bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get(p12->mac->iter) : 1); diff --git a/lib/libssl/src/apps/req.c b/lib/libssl/src/apps/req.c index 6f46e82ecdc..1ed8c84a8d6 100644 --- a/lib/libssl/src/apps/req.c +++ b/lib/libssl/src/apps/req.c @@ -1227,8 +1227,8 @@ start: BIO_printf(bio_err, "%s [%s]:", text, def); (void) BIO_flush(bio_err); if (value != NULL) { - BUF_strlcpy(buf, value, sizeof buf); - BUF_strlcat(buf, "\n", sizeof buf); + strlcpy(buf, value, sizeof buf); + strlcat(buf, "\n", sizeof buf); BIO_printf(bio_err, "%s\n", value); } else { buf[0] = '\0'; @@ -1246,8 +1246,8 @@ start: else if (buf[0] == '\n') { if ((def == NULL) || (def[0] == '\0')) return (1); - BUF_strlcpy(buf, def, sizeof buf); - BUF_strlcat(buf, "\n", sizeof buf); + strlcpy(buf, def, sizeof buf); + strlcat(buf, "\n", sizeof buf); } else if ((buf[0] == '.') && (buf[1] == '\n')) return (1); @@ -1280,8 +1280,8 @@ start: BIO_printf(bio_err, "%s [%s]:", text, def); (void) BIO_flush(bio_err); if (value != NULL) { - BUF_strlcpy(buf, value, sizeof buf); - BUF_strlcat(buf, "\n", sizeof buf); + strlcpy(buf, value, sizeof buf); + strlcat(buf, "\n", sizeof buf); BIO_printf(bio_err, "%s\n", value); } else { buf[0] = '\0'; @@ -1299,8 +1299,8 @@ start: else if (buf[0] == '\n') { if ((def == NULL) || (def[0] == '\0')) return (1); - BUF_strlcpy(buf, def, sizeof buf); - BUF_strlcat(buf, "\n", sizeof buf); + strlcpy(buf, def, sizeof buf); + strlcat(buf, "\n", sizeof buf); } else if ((buf[0] == '.') && (buf[1] == '\n')) return (1); diff --git a/lib/libssl/src/apps/s_socket.c b/lib/libssl/src/apps/s_socket.c index b801cf77960..57015ed8ffc 100644 --- a/lib/libssl/src/apps/s_socket.c +++ b/lib/libssl/src/apps/s_socket.c @@ -306,7 +306,7 @@ redoit: perror("malloc"); return (0); } - BUF_strlcpy(*host, h1->h_name, strlen(h1->h_name) + 1); + strlcpy(*host, h1->h_name, strlen(h1->h_name) + 1); h2 = GetHostByName(*host); if (h2 == NULL) { diff --git a/lib/libssl/src/apps/x509.c b/lib/libssl/src/apps/x509.c index 5841a1b80d0..18b9e71586d 100644 --- a/lib/libssl/src/apps/x509.c +++ b/lib/libssl/src/apps/x509.c @@ -971,15 +971,15 @@ x509_load_serial(char *CAfile, char *serialfile, int create) goto end; } if (serialfile == NULL) { - BUF_strlcpy(buf, CAfile, len); + strlcpy(buf, CAfile, len); for (p = buf; *p; p++) if (*p == '.') { *p = '\0'; break; } - BUF_strlcat(buf, POSTFIX, len); + strlcat(buf, POSTFIX, len); } else - BUF_strlcpy(buf, serialfile, len); + strlcpy(buf, serialfile, len); serial = load_serial(buf, create, NULL); if (serial == NULL) diff --git a/lib/libssl/src/crypto/asn1/a_time.c b/lib/libssl/src/crypto/asn1/a_time.c index f3f28369f41..1978e8d3dcf 100644 --- a/lib/libssl/src/crypto/asn1/a_time.c +++ b/lib/libssl/src/crypto/asn1/a_time.c @@ -147,10 +147,10 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE newlen = t->length + 2 + 1; str = (char *)ret->data; /* Work out the century and prepend */ - if (t->data[0] >= '5') BUF_strlcpy(str, "19", newlen); - else BUF_strlcpy(str, "20", newlen); + if (t->data[0] >= '5') strlcpy(str, "19", newlen); + else strlcpy(str, "20", newlen); - BUF_strlcat(str, (char *)t->data, newlen); + strlcat(str, (char *)t->data, newlen); return ret; } diff --git a/lib/libssl/src/crypto/bio/b_dump.c b/lib/libssl/src/crypto/bio/b_dump.c index ff75069df86..61c9fe20a3a 100644 --- a/lib/libssl/src/crypto/bio/b_dump.c +++ b/lib/libssl/src/crypto/bio/b_dump.c @@ -107,29 +107,29 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), rows++; for (i = 0; i < rows; i++) { buf[0] = '\0'; /* start with empty string */ - BUF_strlcpy(buf, str, sizeof buf); + strlcpy(buf, str, sizeof buf); (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); for (j = 0; j < dump_width; j++) { if (((i*dump_width) + j) >= len) { - BUF_strlcat(buf, " ", sizeof buf); + strlcat(buf, " ", sizeof buf); } else { ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, j == 7 ? '-' : ' '); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); } } - BUF_strlcat(buf, " ", sizeof 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; (void) snprintf(tmp, sizeof tmp, "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); - BUF_strlcat(buf, tmp, sizeof buf); + strlcat(buf, tmp, sizeof buf); } - BUF_strlcat(buf, "\n", sizeof 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 */ diff --git a/lib/libssl/src/crypto/bio/bss_file.c b/lib/libssl/src/crypto/bio/bss_file.c index 995c6233411..acc746260ed 100644 --- a/lib/libssl/src/crypto/bio/bss_file.c +++ b/lib/libssl/src/crypto/bio/bss_file.c @@ -246,14 +246,14 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) b->shutdown = (int)num&BIO_CLOSE; if (num & BIO_FP_APPEND) { if (num & BIO_FP_READ) - BUF_strlcpy(p, "a+", sizeof p); - else BUF_strlcpy(p, "a", sizeof p); + strlcpy(p, "a+", sizeof p); + else strlcpy(p, "a", sizeof p); } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) - BUF_strlcpy(p, "r+", sizeof p); + strlcpy(p, "r+", sizeof p); else if (num & BIO_FP_WRITE) - BUF_strlcpy(p, "w", sizeof p); + strlcpy(p, "w", sizeof p); else if (num & BIO_FP_READ) - BUF_strlcpy(p, "r", sizeof p); + strlcpy(p, "r", sizeof p); else { BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE); ret = 0; diff --git a/lib/libssl/src/crypto/conf/conf_def.c b/lib/libssl/src/crypto/conf/conf_def.c index 39e8b8e5210..26aee50a45e 100644 --- a/lib/libssl/src/crypto/conf/conf_def.c +++ b/lib/libssl/src/crypto/conf/conf_def.c @@ -230,7 +230,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); goto err; } - BUF_strlcpy(section,"default",10); + strlcpy(section,"default",10); if (_CONF_new_data(conf) == 0) { @@ -384,7 +384,7 @@ again: ERR_R_MALLOC_FAILURE); goto err; } - BUF_strlcpy(v->name,pname,strlen(pname)+1); + strlcpy(v->name,pname,strlen(pname)+1); if (!str_copy(conf,psection,&(v->value),start)) goto err; if (strcmp(psection,section) != 0) diff --git a/lib/libssl/src/crypto/dso/dso_lib.c b/lib/libssl/src/crypto/dso/dso_lib.c index 00e65938b91..2f77242d475 100644 --- a/lib/libssl/src/crypto/dso/dso_lib.c +++ b/lib/libssl/src/crypto/dso/dso_lib.c @@ -373,7 +373,7 @@ int DSO_set_filename(DSO *dso, const char *filename) DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); return(0); } - BUF_strlcpy(copied, filename, strlen(filename) + 1); + strlcpy(copied, filename, strlen(filename) + 1); if(dso->filename) free(dso->filename); dso->filename = copied; @@ -432,7 +432,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) ERR_R_MALLOC_FAILURE); return(NULL); } - BUF_strlcpy(result, filename, strlen(filename) + 1); + strlcpy(result, filename, strlen(filename) + 1); } return(result); } diff --git a/lib/libssl/src/crypto/err/err.c b/lib/libssl/src/crypto/err/err.c index 27a19bc52c9..0672477cc87 100644 --- a/lib/libssl/src/crypto/err/err.c +++ b/lib/libssl/src/crypto/err/err.c @@ -1071,7 +1071,7 @@ void ERR_add_error_vdata(int num, va_list args) else str=p; } - BUF_strlcat(str,a,(size_t)s+1); + strlcat(str,a,(size_t)s+1); } } ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); diff --git a/lib/libssl/src/crypto/evp/evp_pbe.c b/lib/libssl/src/crypto/evp/evp_pbe.c index c808b96fef8..37a926c3fcf 100644 --- a/lib/libssl/src/crypto/evp/evp_pbe.c +++ b/lib/libssl/src/crypto/evp/evp_pbe.c @@ -165,7 +165,7 @@ int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, { char obj_tmp[80]; EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); - if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); + if (!pbe_obj) strlcpy (obj_tmp, "NULL", sizeof obj_tmp); else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj); ERR_add_error_data(2, "TYPE=", obj_tmp); return 0; diff --git a/lib/libssl/src/crypto/objects/obj_dat.c b/lib/libssl/src/crypto/objects/obj_dat.c index cf4db7c6b5c..b3388b117d1 100644 --- a/lib/libssl/src/crypto/objects/obj_dat.c +++ b/lib/libssl/src/crypto/objects/obj_dat.c @@ -486,7 +486,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) if (s) { if (buf) - BUF_strlcpy(buf,s,buf_len); + strlcpy(buf,s,buf_len); n=strlen(s); return n; } @@ -576,7 +576,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) *buf++ = '.'; buf_len--; } - BUF_strlcpy(buf,bndec,buf_len); + strlcpy(buf,bndec,buf_len); if (i > buf_len) { buf += buf_len; @@ -598,7 +598,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) i=strlen(tbuf); if (buf && (buf_len > 0)) { - BUF_strlcpy(buf,tbuf,buf_len); + strlcpy(buf,tbuf,buf_len); if (i > buf_len) { buf += buf_len; diff --git a/lib/libssl/src/crypto/pem/pem_lib.c b/lib/libssl/src/crypto/pem/pem_lib.c index aa6a4c93870..93736455fa9 100644 --- a/lib/libssl/src/crypto/pem/pem_lib.c +++ b/lib/libssl/src/crypto/pem/pem_lib.c @@ -137,9 +137,9 @@ void PEM_proc_type(char *buf, int type) else str="BAD-TYPE"; - BUF_strlcat(buf,"Proc-Type: 4,",PEM_BUFSIZE); - BUF_strlcat(buf,str,PEM_BUFSIZE); - BUF_strlcat(buf,"\n",PEM_BUFSIZE); + strlcat(buf,"Proc-Type: 4,",PEM_BUFSIZE); + strlcat(buf,str,PEM_BUFSIZE); + strlcat(buf,"\n",PEM_BUFSIZE); } void PEM_dek_info(char *buf, const char *type, int len, char *str) @@ -148,9 +148,9 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str) long i; int j; - BUF_strlcat(buf,"DEK-Info: ",PEM_BUFSIZE); - BUF_strlcat(buf,type,PEM_BUFSIZE); - BUF_strlcat(buf,",",PEM_BUFSIZE); + strlcat(buf,"DEK-Info: ",PEM_BUFSIZE); + strlcat(buf,type,PEM_BUFSIZE); + strlcat(buf,",",PEM_BUFSIZE); j=strlen(buf); if (j + (len * 2) + 1 > PEM_BUFSIZE) return; diff --git a/lib/libssl/src/crypto/rand/randfile.c b/lib/libssl/src/crypto/rand/randfile.c index 25258046680..5326f710c5e 100644 --- a/lib/libssl/src/crypto/rand/randfile.c +++ b/lib/libssl/src/crypto/rand/randfile.c @@ -142,7 +142,7 @@ err: const char *RAND_file_name(char *buf, size_t size) { - if (BUF_strlcpy(buf,"/dev/urandom",size) >= size) + if (strlcpy(buf,"/dev/urandom",size) >= size) return(NULL); return buf; } diff --git a/lib/libssl/src/crypto/ui/ui_lib.c b/lib/libssl/src/crypto/ui/ui_lib.c index fc03d9b7d4c..58e4c5d7221 100644 --- a/lib/libssl/src/crypto/ui/ui_lib.c +++ b/lib/libssl/src/crypto/ui/ui_lib.c @@ -409,13 +409,13 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) len += sizeof(prompt3) - 1; prompt = (char *)malloc(len + 1); - BUF_strlcpy(prompt, prompt1, len + 1); - BUF_strlcat(prompt, object_desc, len + 1); + strlcpy(prompt, prompt1, len + 1); + strlcat(prompt, object_desc, len + 1); if (object_name) { - BUF_strlcat(prompt, prompt2, len + 1); - BUF_strlcat(prompt, object_name, len + 1); + strlcat(prompt, prompt2, len + 1); + strlcat(prompt, object_name, len + 1); } - BUF_strlcat(prompt, prompt3, len + 1); + strlcat(prompt, prompt3, len + 1); } return prompt; } @@ -869,7 +869,7 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) UIerr(UI_F_UI_SET_RESULT, UI_R_NO_RESULT_BUFFER); return -1; } - BUF_strlcpy(uis->result_buf, result, + strlcpy(uis->result_buf, result, uis->_.string_data.result_maxsize + 1); break; case UIT_BOOLEAN: diff --git a/lib/libssl/src/crypto/x509v3/v3_info.c b/lib/libssl/src/crypto/x509v3/v3_info.c index 2b290ca00c8..c9d6c97b513 100644 --- a/lib/libssl/src/crypto/x509v3/v3_info.c +++ b/lib/libssl/src/crypto/x509v3/v3_info.c @@ -121,9 +121,9 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method ERR_R_MALLOC_FAILURE); return NULL; } - BUF_strlcpy(ntmp, objtmp, nlen); - BUF_strlcat(ntmp, " - ", nlen); - BUF_strlcat(ntmp, vtmp->name, nlen); + strlcpy(ntmp, objtmp, nlen); + strlcat(ntmp, " - ", nlen); + strlcat(ntmp, vtmp->name, nlen); free(vtmp->name); vtmp->name = ntmp; -- 2.20.1