summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pem/pem_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/pem/pem_lib.c')
-rw-r--r--lib/libcrypto/pem/pem_lib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c
index a8db6ffbf5c..50f5733654a 100644
--- a/lib/libcrypto/pem/pem_lib.c
+++ b/lib/libcrypto/pem/pem_lib.c
@@ -131,9 +131,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)
@@ -142,10 +142,12 @@ 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);
+ if (j + (len * 2) + 1 > PEM_BUFSIZE)
+ return;
for (i=0; i<len; i++)
{
buf[j+i*2] =map[(str[i]>>4)&0x0f];