qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Sergei Gavrikov <sergei.gavrikov@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCHv1] slirp: Use strcasecmp() to check tftp mode, tsize
Date: Thu, 13 Jan 2011 11:40:21 +0100	[thread overview]
Message-ID: <20110113104021.GB7296@edde.se.axis.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1101121516290.5210@sg-desktop.belvok.com>

On Wed, Jan 12, 2011 at 03:57:18PM +0200, Sergei Gavrikov wrote:
> From: Sergei Gavrikov <sergei.gavrikov@gmail.com>
> 
> 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 <sergei.gavrikov@gmail.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

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;
>  
> 

      reply	other threads:[~2011-01-13 10:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 21:46 [Qemu-devel] [PATCH] slirp/tftp.c: fix mode field Sergei Gavrikov
2011-01-12  7:22 ` [Qemu-devel] " Sergei Gavrikov
2011-01-12  9:56   ` Stefan Hajnoczi
2011-01-12 10:22     ` Sergei Gavrikov
2011-01-12 12:17       ` Stefan Hajnoczi
2011-01-12 12:32         ` Sergei Gavrikov
2011-01-12 13:57         ` [Qemu-devel] [PATCHv1] slirp: Use strcasecmp() to check tftp mode, tsize Sergei Gavrikov
2011-01-13 10:40           ` Edgar E. Iglesias [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110113104021.GB7296@edde.se.axis.com \
    --to=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sergei.gavrikov@gmail.com \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).