use strlcat

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14934 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-24 20:14:10 +00:00
parent 8f5b48e13c
commit 0be6a3d662

View File

@@ -540,13 +540,13 @@ void ccc(void)
void mec(char *msg, enum protection_level level) void mec(char *msg, enum protection_level level)
{ {
void *buf; void *buf;
size_t len; size_t len, buf_size;
if(!sec_complete) { if(!sec_complete) {
reply(503, "Incomplete security data exchange."); reply(503, "Incomplete security data exchange.");
return; return;
} }
buf = malloc(strlen(msg) + 2); /* XXX go figure out where that 2 buf_size = strlen(msg) + 2;
comes from :-) */ buf = malloc(buf_size);
len = base64_decode(msg, buf); len = base64_decode(msg, buf);
command_prot = level; command_prot = level;
if(len == (size_t)-1) { if(len == (size_t)-1) {
@@ -560,7 +560,7 @@ void mec(char *msg, enum protection_level level)
} }
((char*)buf)[len] = '\0'; ((char*)buf)[len] = '\0';
if(strstr((char*)buf, "\r\n") == NULL) if(strstr((char*)buf, "\r\n") == NULL)
strcat((char*)buf, "\r\n"); strlcat((char*)buf, "\r\n", buf_size);
new_ftp_command(buf); new_ftp_command(buf);
} }