Received: from [140.186.70.92] (port=38996 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdKbU-0001b2-6q for qemu-devel@nongnu.org; Thu, 13 Jan 2011 05:40:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdKbT-0000zj-38 for qemu-devel@nongnu.org; Thu, 13 Jan 2011 05:40:28 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:58787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdKbS-0000zX-V5 for qemu-devel@nongnu.org; Thu, 13 Jan 2011 05:40:27 -0500 Received: by wwi18 with SMTP id 18so1512169wwi.10 for ; Thu, 13 Jan 2011 02:40:25 -0800 (PST) Date: Thu, 13 Jan 2011 11:40:21 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCHv1] slirp: Use strcasecmp() to check tftp mode, tsize Message-ID: <20110113104021.GB7296@edde.se.axis.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergei Gavrikov Cc: Stefan Hajnoczi , QEMU Developers On Wed, Jan 12, 2011 at 03:57:18PM +0200, Sergei Gavrikov wrote: > From: Sergei Gavrikov > > According to RFC 1350 (TFTP Revision 2) the mode field can contain any > combination of upper and lower case; also RFC 2349 propagates that the > transfer size option ("tsize") is case in-sensitive too. > > Current implementation of embedded TFTP server missed that what does > mess some TFTP clients. Fixed by using STRCASECMP(3) in the required > places. > > Signed-off-by: Sergei Gavrikov > Reviewed-by: Stefan Hajnoczi I've applied this, thanks both of you. Cheers > --- > slirp/tftp.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/slirp/tftp.c b/slirp/tftp.c > index 55e4692..1821648 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; > } > @@ -351,7 +351,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen) > value = (const char *)&tp->x.tp_buf[k]; > k += strlen(value) + 1; > > - if (strcmp(key, "tsize") == 0) { > + if (strcasecmp(key, "tsize") == 0) { > int tsize = atoi(value); > struct stat stat_p; > >