This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
tftp_server sends entire buffer not just data.
- From: Bob Holmberg <bob_holmberg at yahoo dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Tue, 13 May 2003 12:15:41 -0700 (PDT)
- Subject: tftp_server sends entire buffer not just data.
When retrieving a file from the TFTP_Server
"packages/net/common/current/src/tftp_server.c"
using the "tftp_dummy_file.c" file system, the
retrieved file was always the size of the buffer,
not truncated to the size of the data in the file.
Cause: server opens a file to read in WRONLY mode.
fix: open file to read in RDONLY mode instead.
diff -u -r1.4 tftp_server.c
--- tftp_server.c 23 Apr 2003 08:52:09 -0000
1.4
+++ tftp_server.c 13 May 2003 19:05:32 -0000
@@ -433,7 +433,7 @@
return;
}
- if ((fd = (server->ops->open)(hdr->th_stuff,
O_WRONLY)) < 0) {
+ if ((fd = (server->ops->open)(hdr->th_stuff,
O_RDONLY)) < 0) {
tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr,
from_len);
close(s);
freeaddrinfo(res);
-=-=-=-=-=-
-- Bob Holmberg
Index: tftp_server.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/tftp_server.c,v
retrieving revision 1.4
diff -u -r1.4 tftp_server.c
--- tftp_server.c 23 Apr 2003 08:52:09 -0000 1.4
+++ tftp_server.c 13 May 2003 19:07:40 -0000
@@ -433,7 +433,7 @@
return;
}
- if ((fd = (server->ops->open)(hdr->th_stuff, O_WRONLY)) < 0) {
+ if ((fd = (server->ops->open)(hdr->th_stuff, O_RDONLY)) < 0) {
tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len);
close(s);
freeaddrinfo(res);