summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2014-04-19 00:41:39 +0000
committerBob Beck <beck@cvs.openbsd.org>2014-04-19 00:41:39 +0000
commitb99ddb4df8b0e933b6392cad7b5acc1dddc794d2 (patch)
tree468786947d8caa1871340bd50d8317ed9a55824f /lib
parentf4f934735e34f87d82d016e11282cef8f632172d (diff)
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@
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/a_time.c6
-rw-r--r--lib/libcrypto/bio/b_dump.c14
-rw-r--r--lib/libcrypto/bio/bss_file.c10
-rw-r--r--lib/libcrypto/conf/conf_def.c4
-rw-r--r--lib/libcrypto/dso/dso_lib.c4
-rw-r--r--lib/libcrypto/err/err.c2
-rw-r--r--lib/libcrypto/evp/evp_pbe.c2
-rw-r--r--lib/libcrypto/objects/obj_dat.c6
-rw-r--r--lib/libcrypto/pem/pem_lib.c12
-rw-r--r--lib/libcrypto/rand/randfile.c2
-rw-r--r--lib/libcrypto/ui/ui_lib.c12
-rw-r--r--lib/libcrypto/x509v3/v3_info.c6
12 files changed, 40 insertions, 40 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;