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 else
str="BAD-TYPE"; str="BAD-TYPE";
strcat(buf,"Proc-Type: 4,"); strlcat(buf, "Proc-Type: 4,", PEM_BUFSIZE);
strcat(buf,str); strlcat(buf, str, PEM_BUFSIZE);
strcat(buf,"\n"); strlcat(buf, "\n", PEM_BUFSIZE);
} }
void PEM_dek_info(char *buf, const char *type, int len, char *str) 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; long i;
int j; int j;
strcat(buf,"DEK-Info: "); strlcat(buf, "DEK-Info: ", PEM_BUFSIZE);
strcat(buf,type); strlcat(buf, type, PEM_BUFSIZE);
strcat(buf,","); strlcat(buf, ",", PEM_BUFSIZE);
j=strlen(buf); j=strlen(buf);
for (i=0; i<len; i++) 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; k=0;
for (;;) for (;;)
{ {
sprintf(b->data,"%s/%08lx.%s%d",ctx->dirs[i],h, snprintf(b->data, b->max, "%s/%08lx.%s%d",
postfix,k); ctx->dirs[i], h, postfix, k);
k++; k++;
if (stat(b->data,&st) < 0) if (stat(b->data,&st) < 0)
break; break;