Patchwork Re: [PATCH] slirp/tftp.c: fix mode field

login
register
mail settings
Submitter Sergei Gavrikov
Date Jan. 12, 2011, 10:22 a.m.
Message ID <alpine.DEB.2.00.1101121201070.4013@sg-desktop.belvok.com>
Download mbox | patch
Permalink /patch/78535/
State New
Headers show

Comments

Sergei Gavrikov - Jan. 12, 2011, 10:22 a.m.
On Wed, 12 Jan 2011, Stefan Hajnoczi wrote:

> On Wed, Jan 12, 2011 at 7:22 AM, Sergei Gavrikov
> <sergei.gavrikov@gmail.com> wrote:
> > 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;
> >   }
> 
> According to RFC 2349 the "tsize" option is also case-insensitive.
> Want to include a fix for that in this patch?

It was good to know. If you mean the below I "merge" that in one. Thank
you for review.

Sergei

Signed-off-by: Sergei Gavrikov <sergei.gavrikov@gmail.com>
Acked-by: Stefan Hajnoczi <stefanha@gmail.com>
----
 slirp/tftp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Stefan Hajnoczi - Jan. 12, 2011, 12:17 p.m.
On Wed, Jan 12, 2011 at 10:22 AM, Sergei Gavrikov
<sergei.gavrikov@gmail.com> wrote:
> It was good to know. If you mean the below I "merge" that in one. Thank
> you for review.
>
> Sergei
>
> Signed-off-by: Sergei Gavrikov <sergei.gavrikov@gmail.com>
> Acked-by: Stefan Hajnoczi <stefanha@gmail.com>

Your new patch looks fine.  I prefer:
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Stefan
Sergei Gavrikov - Jan. 12, 2011, 12:32 p.m.
On Wed, 12 Jan 2011, Stefan Hajnoczi wrote:

> On Wed, Jan 12, 2011 at 10:22 AM, Sergei Gavrikov
> <sergei.gavrikov@gmail.com> wrote:
> > It was good to know. If you mean the below I "merge" that in one. Thank
> > you for review.
> >
> > Sergei
> >
> > Signed-off-by: Sergei Gavrikov <sergei.gavrikov@gmail.com>
> > Acked-by: Stefan Hajnoczi <stefanha@gmail.com>
> 
> Your new patch looks fine.  I prefer:
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> 
> Stefan

Excuse, please, that 'Acked-by'. I'm get it. Thank you!

Sergei

Patch

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;