use bounded string ops (especially libraries)
This commit is contained in:
parent
96df404b38
commit
848c8ac0ef
18
crypto/dist/openssl/apps/ca.c
vendored
18
crypto/dist/openssl/apps/ca.c
vendored
@ -451,9 +451,9 @@ bad:
|
||||
#else
|
||||
strncpy(buf[0],X509_get_default_cert_area(),
|
||||
sizeof(buf[0])-2-sizeof(CONFIG_FILE));
|
||||
strcat(buf[0],"/");
|
||||
strlcat(buf[0], "/", sizeof(buf[0]));
|
||||
#endif
|
||||
strcat(buf[0],CONFIG_FILE);
|
||||
strlcat(buf[0], CONFIG_FILE, sizeof(buf[0]));
|
||||
configfile=buf[0];
|
||||
}
|
||||
|
||||
@ -951,9 +951,9 @@ bad:
|
||||
strncpy(buf[0],serialfile,BSIZE-4);
|
||||
|
||||
#ifdef VMS
|
||||
strcat(buf[0],"-new");
|
||||
strlcat(buf[0], "-new", sizeof(buf[0]));
|
||||
#else
|
||||
strcat(buf[0],".new");
|
||||
strlcat(buf[0], ".new", sizeof(buf[0]));
|
||||
#endif
|
||||
|
||||
if (!save_serial(buf[0],serial)) goto err;
|
||||
@ -961,9 +961,9 @@ bad:
|
||||
strncpy(buf[1],dbfile,BSIZE-4);
|
||||
|
||||
#ifdef VMS
|
||||
strcat(buf[1],"-new");
|
||||
strlcat(buf[1], "-new", sizeof(buf[1]));
|
||||
#else
|
||||
strcat(buf[1],".new");
|
||||
strlcat(buf[1], ".new", sizeof(buf[1]));
|
||||
#endif
|
||||
|
||||
if (BIO_write_filename(out,buf[1]) <= 0)
|
||||
@ -991,7 +991,7 @@ bad:
|
||||
strncpy(buf[2],outdir,BSIZE-(j*2)-6);
|
||||
|
||||
#ifndef VMS
|
||||
strcat(buf[2],"/");
|
||||
strlcat(buf[2], "/", sizeof(buf[2]));
|
||||
#endif
|
||||
|
||||
n=(unsigned char *)&(buf[2][strlen(buf[2])]);
|
||||
@ -999,7 +999,9 @@ bad:
|
||||
{
|
||||
for (k=0; k<j; k++)
|
||||
{
|
||||
sprintf((char *)n,"%02X",(unsigned char)*(p++));
|
||||
snprintf((char *)n,
|
||||
sizeof(buf[2]) - (n - buf[2]),
|
||||
"%02X",(unsigned char)*(p++));
|
||||
n+=2;
|
||||
}
|
||||
}
|
||||
|
2
crypto/dist/openssl/apps/enc.c
vendored
2
crypto/dist/openssl/apps/enc.c
vendored
@ -391,7 +391,7 @@ bad:
|
||||
{
|
||||
char buf[200];
|
||||
|
||||
sprintf(buf,"enter %s %s password:",
|
||||
snprintf(buf, sizeof(buf), "enter %s %s password:",
|
||||
OBJ_nid2ln(EVP_CIPHER_nid(cipher)),
|
||||
(enc)?"encryption":"decryption");
|
||||
strbuf[0]='\0';
|
||||
|
16
crypto/dist/openssl/apps/req.c
vendored
16
crypto/dist/openssl/apps/req.c
vendored
@ -1011,18 +1011,18 @@ start: for (;;)
|
||||
}
|
||||
/* If OBJ not recognised ignore it */
|
||||
if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
|
||||
sprintf(buf,"%s_default",v->name);
|
||||
snprintf(buf, sizeof(buf), "%s_default", v->name);
|
||||
if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||
def="";
|
||||
|
||||
sprintf(buf,"%s_value",v->name);
|
||||
snprintf(buf, sizeof(buf), "%s_value", v->name);
|
||||
if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||
value=NULL;
|
||||
|
||||
sprintf(buf,"%s_min",v->name);
|
||||
snprintf(buf, sizeof(buf), "%s_min", v->name);
|
||||
min=(int)CONF_get_number(req_conf,dn_sect,buf);
|
||||
|
||||
sprintf(buf,"%s_max",v->name);
|
||||
snprintf(buf, sizeof(buf), "%s_max", v->name);
|
||||
max=(int)CONF_get_number(req_conf,dn_sect,buf);
|
||||
|
||||
if (!add_DN_object(subj,v->value,def,value,nid,
|
||||
@ -1056,20 +1056,20 @@ start2: for (;;)
|
||||
if ((nid=OBJ_txt2nid(type)) == NID_undef)
|
||||
goto start2;
|
||||
|
||||
sprintf(buf,"%s_default",type);
|
||||
snprintf(buf, sizeof(buf), "%s_default", type);
|
||||
if ((def=CONF_get_string(req_conf,attr_sect,buf))
|
||||
== NULL)
|
||||
def="";
|
||||
|
||||
sprintf(buf,"%s_value",type);
|
||||
snprintf(buf, sizeof(buf), |