tftpd mode check should ignore case

Brecht Ameije bam at abm.be
Thu Oct 6 09:38:25 UTC 2011


Hi all,

When using Busybox tftpd as a tftp server in combination with the RedBoot
tftp client, I got a "malformed packet" response to every request.

The reason is that RedBoot requests "OCTET" mode in upper case, where
Busybox only checks for the lower case "octet" mode variant.

The tftp RFC 1350 states: "The mode field contains the
   string "netascii", "octet", or "mail" (or any combination of upper
   and lower case, such as "NETASCII", NetAscii", etc.) in netascii
   indicating the three modes defined in the protocol.

Therefore I suggest to change busybox-1.19.0/networking/tftp.c line 816:

-	if (mode >= block_buf + result || strcmp(mode, "octet") != 0) {
+	if (mode >= block_buf + result || strcasecmp(mode, "octet") != 0) {

I'm new to suggesting patches etc., so if more information is needed, please
ask.

Thanks,
Brecht



More information about the busybox mailing list