From 719af6b0ef4719bdbd246d185ad65efdb3212ac0 Mon Sep 17 00:00:00 2001 From: sgunderson Date: Tue, 9 Oct 2001 21:10:53 +0000 Subject: [PATCH] Fixed a problem where a trailing null byte would be sent. --- ftpd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftpd.c b/ftpd.c index 23a7134..73f1dca 100644 --- a/ftpd.c +++ b/ftpd.c @@ -599,7 +599,7 @@ int process_all_clients(const fd_set * const active_clients, const int num_ac) void finish_transfer(struct ftran * const f) { char finished[] = "226 Transfer complete.\r\n"; - if (send(f->owner->sock, finished, sizeof(finished), 0) == -1 && errno == EPIPE) { + if (send(f->owner->sock, finished, strlen(finished), 0) == -1 && errno == EPIPE) { destroy_conn(f->owner); return; } @@ -1130,7 +1130,7 @@ void accept_new_client(int * const server_sock) memcpy(&(c->addr), &tempaddr, sizeof(struct sockaddr)); #endif - if (send(tempsock, hello, sizeof(hello), 0) == -1 && errno == EPIPE) + if (send(tempsock, hello, strlen(hello), 0) == -1 && errno == EPIPE) destroy_conn(c); } } -- 2.39.2