qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] slirp/tftp.c: fix mode field


From: Sergei Gavrikov
Subject: [Qemu-devel] Re: [PATCH] slirp/tftp.c: fix mode field
Date: Wed, 12 Jan 2011 09:22:33 +0200 (EET)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Mon, 10 Jan 2011, Sergei Gavrikov wrote:
> According to RFC 1350 http://www.ietf.org/rfc/rfc1350.txt [Page 5]:
> 
>     The mode field contains the string "netascii", "octet", or "mail"
>     (or any combination of upper and lower case, such as "NETASCII",
>     NetAscii", etc.)
> 
> Unfortunately, current implementation of internal TFTP server breaks the
> requests with the mode fields like "OCTET\0". For example, the RedBoot's
> TFTP client sends the same (in upper case). So, it is not possible to
> get internal TFTP working with RedBoot loader. If you do not have doubts
> about STRCASECMP(3), a patch is provided.

... 

> diff --git a/slirp/tftp.c b/slirp/tftp.c
> index 55e4692..6ad1da0 100644
> --- a/slirp/tftp.c
> +++ b/slirp/tftp.c
> @@ -311,7 +311,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t 
> *tp, int pktlen)
>      return;
>    }
>  
> -  if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) {
> +  if (strcasecmp(&tp->x.tp_buf[k], "octet") != 0) {

The above adds a warning, renewed (no warning).

Signed-off-by: Sergei Gavrikov <address@hidden>
---
 slirp/tftp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/slirp/tftp.c b/slirp/tftp.c
index 55e4692..a455ad1 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -311,7 +311,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t 
*tp, int pktlen)
     return;
   }
 
-  if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) {
+  if (strcasecmp((const char *)&tp->x.tp_buf[k], "octet") != 0) {
       tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
       return;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]