use bounded string op (only one sprintf remains - still no clue)

This commit is contained in:
itojun 2003-07-14 13:24:00 +00:00
parent a395b35ba2
commit c187ba994b
2 changed files with 8 additions and 8 deletions

View File

@ -140,9 +140,9 @@ void PEM_proc_type(char *buf, int type)
else
str="BAD-TYPE";
strcat(buf,"Proc-Type: 4,");
strcat(buf,str);
strcat(buf,"\n");
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)
@ -151,9 +151,9 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str)
long i;
int j;
strcat(buf,"DEK-Info: ");
strcat(buf,type);
strcat(buf,",");
strlcat(buf, "DEK-Info: ", PEM_BUFSIZE);
strlcat(buf, type, PEM_BUFSIZE);
strlcat(buf, ",", PEM_BUFSIZE);
j=strlen(buf);
for (i=0; i<len; i++)
{

View File

@ -302,8 +302,8 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
k=0;
for (;;)
{
sprintf(b->data,"%s/%08lx.%s%d",ctx->dirs[i],h,
postfix,k);
snprintf(b->data, b->max, "%s/%08lx.%s%d",
ctx->dirs[i], h, postfix, k);
k++;
if (stat(b->data,&st) < 0)
break;