[ipxe-devel] Failure to encode tftp URI

Simon Rowe simon.rowe at eu.citrix.com
Fri Oct 21 14:12:51 UTC 2011


Hi,

I've a report of an issue with tftp boot and a filename of the form

	/#MPCPathBoot#... 

this results in a URI path="/" and URI fragment="MPCPathBoot#..." and an 
attempt to boot an empty string.

The following patch is said to fix this:

@@ -185,11 +186,17 @@
                port = htons ( TFTP_PORT );
        if ( blksize < TFTP_DEFAULT_BLKSIZE )
                blksize = TFTP_DEFAULT_BLKSIZE;
-       snprintf ( uri_string, sizeof ( uri_string ),
-                  "tftp%s://%s:%d%s%s?blksize=%zd",
-                  sizeonly ? "size" : "",
-                  inet_ntoa ( address ), ntohs ( port ),
-                  ( ( filename[0] == '/' ) ? "" : "/" ), filename, blksize );
+        snprintf ( uri_string, sizeof ( uri_string ),
+                "tftp%s://%s:%d%s",
+                sizeonly ? "size" : "",
+                inet_ntoa ( address ), ntohs ( port ),
+                ( ( filename[0] == '/' ) ? "" : "/" ));
+        uri_encode ((char *)filename, uri_string + strlen ( uri_string ),
+                sizeof ( uri_string ) - strlen ( uri_string ), URI_PATH );
+        snprintf ( uri_string + strlen ( uri_string ),
+                sizeof ( uri_string ) - strlen ( uri_string ),
+                "?blksize=%zd",
+                blksize );
        DBG ( " %s", uri_string );

        /* Open PXE TFTP connection */
We're using a pre 1.0.0 snapshot but the code is unchanged in tip.
Is this the correct solution?
Thanks,
		Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20111021/b159fab0/attachment.htm>


More information about the ipxe-devel mailing list