From 0be6a3d6625fd3e44322d57a3bf368b863d9ab0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 24 Apr 2005 20:14:10 +0000 Subject: [PATCH] use strlcat git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14934 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftp/security.c b/appl/ftp/ftp/security.c index 11e553562..09063d71b 100644 --- a/appl/ftp/ftp/security.c +++ b/appl/ftp/ftp/security.c @@ -540,13 +540,13 @@ void ccc(void) void mec(char *msg, enum protection_level level) { void *buf; - size_t len; + size_t len, buf_size; if(!sec_complete) { reply(503, "Incomplete security data exchange."); return; } - buf = malloc(strlen(msg) + 2); /* XXX go figure out where that 2 - comes from :-) */ + buf_size = strlen(msg) + 2; + buf = malloc(buf_size); len = base64_decode(msg, buf); command_prot = level; if(len == (size_t)-1) { @@ -560,7 +560,7 @@ void mec(char *msg, enum protection_level level) } ((char*)buf)[len] = '\0'; if(strstr((char*)buf, "\r\n") == NULL) - strcat((char*)buf, "\r\n"); + strlcat((char*)buf, "\r\n", buf_size); new_ftp_command(buf); }