[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] Bug in ftpd (inetutils 1.5)
From: |
Asier Tamayo |
Subject: |
[bug-inetutils] Bug in ftpd (inetutils 1.5) |
Date: |
Thu, 9 Oct 2008 15:21:11 +0200 |
Dear Sir/Madam,
I have observed a possible bug in the ftpd command of inetutils 1.5. I am
compiling it with HAVE_MMAP not being defined.
My system uses inetd, which launches ftpd. I connect with an FTP client to that
system, and everything seems to run correctly. The problem appears when I try
to download a file in binary mode: ftpd retrieves me an empty file.
I have studied the ftpd.c file, and seen a possible source of error: when ftpd
wants to download a file, the retrieve() function calls send_data() with a
buffer_size==0. In send_data(), in binary downloads, a buffer is created with
malloc((u_int)blksize), being blksize buffer_size. Later, blksize bytes are
read to that buffer. As a result, nothing is read and sent over the net.
I have tested a possible solution and it seems to be working: in retrieve(),
before calling send_data(), the value of buffer_size is set to the size of the
file, or BUFSIZ, if that size is too big. See below for the code.
Is this bug a real one? Is my solution correct? Have you got a newer ftpd.c
file?
Best regards,
Asier Tamayo Arbide.
e-mail: address@hidden
---------------------------------------------------
retrieve (const char *cmd, const char *name)
{
(...)
perror_reply (550, name);
goto done;
}
}
if (cmd == 0)
buffer_size = (st.st_size < BUFSIZ)? st.st_size, BUFSIZ;
dout = dataconn (name, st.st_size, "w");
if (dout == NULL)
goto done;
send_data (fin, dout, buffer_size);
(...)
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-inetutils] Bug in ftpd (inetutils 1.5),
Asier Tamayo <=