From 58dcb2e15e2da84c6bdd7313ac6b090748474cce Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 31 Mar 2011 04:52:47 +0100 Subject: [PATCH] [tftp] Avoid setting current working URI to "tftp://0.0.0.0/" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set the current working URI to NULL rather than to "tftp://0.0.0.0/". Reported-by: Piotr JaroszyƄski Signed-off-by: Michael Brown --- src/net/udp/tftp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index f4e9f4c61..7cd211e41 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -1245,11 +1245,15 @@ static int tftp_apply_settings ( void ) { * applicators. */ if ( tftp_server.s_addr != last_tftp_server.s_addr ) { - snprintf ( uri_string, sizeof ( uri_string ), - "tftp://%s/", inet_ntoa ( tftp_server ) ); - uri = parse_uri ( uri_string ); - if ( ! uri ) - return -ENOMEM; + if ( tftp_server.s_addr ) { + snprintf ( uri_string, sizeof ( uri_string ), + "tftp://%s/", inet_ntoa ( tftp_server ) ); + uri = parse_uri ( uri_string ); + if ( ! uri ) + return -ENOMEM; + } else { + uri = NULL; + } churi ( uri ); uri_put ( uri ); }