diff options
author | Sergei Gavrikov <sergei.gavrikov@gmail.com> | 2011-01-12 15:57:18 +0200 |
---|---|---|
committer | Edgar E. Iglesias <edgar@axis.com> | 2011-01-13 11:38:44 +0100 |
commit | 439835070530072b073c83e246baf787111c07b8 (patch) | |
tree | 6702e3415f9a44313ac3ed0e95fcdd4d5c7fd243 /tftp.c | |
parent | 529f51e8950f1c03777c89f19007c41695b6229e (diff) | |
download | slirp-439835070530072b073c83e246baf787111c07b8.zip slirp-439835070530072b073c83e246baf787111c07b8.tar.gz slirp-439835070530072b073c83e246baf787111c07b8.tar.bz2 |
slirp: Use strcasecmp() to check tftp mode, tsize
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>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
Diffstat (limited to 'tftp.c')
-rw-r--r-- | tftp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -310,7 +310,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; } @@ -349,7 +349,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; |