]> git.sesse.net Git - betaftpd/commitdiff
Fixed a problem where a trailing null byte would be sent.
authorsgunderson <sgunderson>
Tue, 9 Oct 2001 21:10:53 +0000 (21:10 +0000)
committersgunderson <sgunderson>
Tue, 9 Oct 2001 21:10:53 +0000 (21:10 +0000)
ftpd.c

diff --git a/ftpd.c b/ftpd.c
index 23a7134e51665e384d598839ef28770e3faa95b1..73f1dcad7105cf5232acc6605051e0a0c12798a7 100644 (file)
--- 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);
                }
        }