use intrinsic strlcpy and strlcat everywhere so we only have one set of
authorbeck <beck@openbsd.org>
Sat, 19 Apr 2014 00:41:37 +0000 (00:41 +0000)
committerbeck <beck@openbsd.org>
Sat, 19 Apr 2014 00:41:37 +0000 (00:41 +0000)
funcitons to check for incorrect use. keep BUF_strlcpy and BUF_strlcat
for API comptibility only.
ok tedu@

31 files changed:
lib/libcrypto/asn1/a_time.c
lib/libcrypto/bio/b_dump.c
lib/libcrypto/bio/bss_file.c
lib/libcrypto/conf/conf_def.c
lib/libcrypto/dso/dso_lib.c
lib/libcrypto/err/err.c
lib/libcrypto/evp/evp_pbe.c
lib/libcrypto/objects/obj_dat.c
lib/libcrypto/pem/pem_lib.c
lib/libcrypto/rand/randfile.c
lib/libcrypto/ui/ui_lib.c
lib/libcrypto/x509v3/v3_info.c
lib/libssl/src/apps/apps.c
lib/libssl/src/apps/ca.c
lib/libssl/src/apps/engine.c
lib/libssl/src/apps/pkcs12.c
lib/libssl/src/apps/req.c
lib/libssl/src/apps/s_socket.c
lib/libssl/src/apps/x509.c
lib/libssl/src/crypto/asn1/a_time.c
lib/libssl/src/crypto/bio/b_dump.c
lib/libssl/src/crypto/bio/bss_file.c
lib/libssl/src/crypto/conf/conf_def.c
lib/libssl/src/crypto/dso/dso_lib.c
lib/libssl/src/crypto/err/err.c
lib/libssl/src/crypto/evp/evp_pbe.c
lib/libssl/src/crypto/objects/obj_dat.c
lib/libssl/src/crypto/pem/pem_lib.c
lib/libssl/src/crypto/rand/randfile.c
lib/libssl/src/crypto/ui/ui_lib.c
lib/libssl/src/crypto/x509v3/v3_info.c

index f3f2836..1978e8d 100644 (file)
@@ -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;
 }
index ff75069..61c9fe2 100644 (file)
@@ -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
                 */
index 995c623..acc7462 100644 (file)
@@ -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;
index 39e8b8e..26aee50 100644 (file)
@@ -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)
index 00e6593..2f77242 100644 (file)
@@ -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);
        }
index 27a19bc..0672477 100644 (file)
@@ -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);
index c808b96..37a926c 100644 (file)
@@ -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;
index cf4db7c..b3388b1 100644 (file)
@@ -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;
index aa6a4c9..9373645 100644 (file)
@@ -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;
index 2525804..5326f71 100644 (file)
@@ -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;
 }
index fc03d9b..58e4c5d 100644 (file)
@@ -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:
index 2b290ca..c9d6c97 100644 (file)
@@ -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;
                
index 446bb4d..4a8be99 100644 (file)
@@ -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
index c582549..3f2d106 100644 (file)
@@ -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;
index 5ed33d0..7898c96 100644 (file)
@@ -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;
 }
index 933fded..44ee698 100644 (file)
@@ -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);
index 6f46e82..1ed8c84 100644 (file)
@@ -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);
 
index b801cf7..57015ed 100644 (file)
@@ -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) {
index 5841a1b..18b9e71 100644 (file)
@@ -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)
index f3f2836..1978e8d 100644 (file)
@@ -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;
 }
index ff75069..61c9fe2 100644 (file)
@@ -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
                 */
index 995c623..acc7462 100644 (file)
@@ -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;
index 39e8b8e..26aee50 100644 (file)
@@ -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)
index 00e6593..2f77242 100644 (file)
@@ -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);
        }
index 27a19bc..0672477 100644 (file)
@@ -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);
index c808b96..37a926c 100644 (file)
@@ -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;
index cf4db7c..b3388b1 100644 (file)
@@ -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;
index aa6a4c9..9373645 100644 (file)
@@ -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;
index 2525804..5326f71 100644 (file)
@@ -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;
 }
index fc03d9b..58e4c5d 100644 (file)
@@ -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:
index 2b290ca..c9d6c97 100644 (file)
@@ -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;