77d0810
From 20e077f4b5be64518b8ff996c11973132e8a9ff3 Mon Sep 17 00:00:00 2001
77d0810
From: Mark Salter <msalter@redhat.com>
77d0810
Date: Tue, 7 Mar 2017 18:26:17 -0500
ce21efa
Subject: [PATCH 107/123] Fix malformed tftp packets
77d0810
77d0810
0088-Normalize-slashes-in-tftp-paths.patch collapses multiple contiguous
77d0810
slashes in a filename into one slash in the tftp packet filename field.
77d0810
However, the packet buffer pointer is advanced using the original name.
77d0810
This leaves unitialized data between the name field and the type field
77d0810
leading to tftp errors. Use the length of the normalized name to avoid
77d0810
this.
77d0810
77d0810
Signed-off-by: Mark Salter <msalter@redhat.com>
77d0810
---
77d0810
 grub-core/net/tftp.c | 4 ++--
77d0810
 1 file changed, 2 insertions(+), 2 deletions(-)
77d0810
77d0810
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
77d0810
index 63bbc28ef..c4b5205d0 100644
77d0810
--- a/grub-core/net/tftp.c
77d0810
+++ b/grub-core/net/tftp.c
77d0810
@@ -360,8 +360,8 @@ tftp_open (struct grub_file *file, const char *filename)
77d0810
   /* Copy and normalize the filename to work-around issues on some tftp
77d0810
      servers when file names are being matched for remapping. */
77d0810
   grub_normalize_filename (rrq, filename);
77d0810
-  rrqlen += grub_strlen (filename) + 1;
77d0810
-  rrq += grub_strlen (filename) + 1;
77d0810
+  rrqlen += grub_strlen (rrq) + 1;
77d0810
+  rrq += grub_strlen (rrq) + 1;
77d0810
 
77d0810
   grub_strcpy (rrq, "octet");
77d0810
   rrqlen += grub_strlen ("octet") + 1;
77d0810
-- 
ce21efa
2.14.3
77d0810