From: sgunderson Date: Tue, 9 Oct 2001 21:10:53 +0000 (+0000) Subject: Fixed a problem where a trailing null byte would be sent. X-Git-Url: https://git.sesse.net/?p=betaftpd;a=commitdiff_plain;h=719af6b0ef4719bdbd246d185ad65efdb3212ac0 Fixed a problem where a trailing null byte would be sent. --- 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); } }