diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/autoboot.c | 10 | ||||
-rw-r--r-- | src/usr/imgmgmt.c | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 8c4398c3f..2fa10e6bc 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -61,7 +61,9 @@ int boot_next_server_and_filename ( struct in_addr next_server, const char *filename ) { struct uri *uri; struct image *image; - char buf[ 23 /* tftp://xxx.xxx.xxx.xxx/ */ + strlen(filename) + 1 ]; + char buf[ 23 /* tftp://xxx.xxx.xxx.xxx/ */ + + ( 3 * strlen(filename) ) /* completely URI-encoded */ + + 1 /* NUL */ ]; int filename_is_absolute; int rc; @@ -78,8 +80,10 @@ int boot_next_server_and_filename ( struct in_addr next_server, * between filenames with and without initial slashes, * which is significant for TFTP. */ - snprintf ( buf, sizeof ( buf ), "tftp://%s/%s", - inet_ntoa ( next_server ), filename ); + snprintf ( buf, sizeof ( buf ), "tftp://%s/", + inet_ntoa ( next_server ) ); + uri_encode ( filename, buf + strlen ( buf ), + sizeof ( buf ) - strlen ( buf ), URI_PATH ); filename = buf; } diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c index 0ffff5d4b..023e3f0f5 100644 --- a/src/usr/imgmgmt.c +++ b/src/usr/imgmgmt.c @@ -61,7 +61,7 @@ int imgfetch ( struct image *image, const char *uri_string, if ( password ) uri->password = "***"; unparse_uri ( uri_string_redacted, sizeof ( uri_string_redacted ), - uri ); + uri, URI_ALL ); uri->password = password; if ( ( rc = create_downloader ( &monojob, image, image_register, |