[gPXE-devel] [PATCH 1/2] [uri] Fix NULL dereference in parse_uri()

Piotr Jaroszyński p.jaroszynski at gmail.com
Mon Apr 12 11:54:48 EDT 2010


Don't try to parse authroity if it's not there.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski at gmail.com>
---
 src/core/uri.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/core/uri.c b/src/core/uri.c
index 6a1f2e5..8428d19 100644
--- a/src/core/uri.c
+++ b/src/core/uri.c
@@ -148,6 +148,9 @@ struct uri * parse_uri ( const char *uri_string ) {
 	} else {
 		/* Absolute/relative path */
 		uri->path = path;
+
+		// No authority so jump directly to decoding
+		goto decode;
 	}
 
 	/* Split authority into user[:password] and host[:port] portions */
@@ -172,6 +175,7 @@ struct uri * parse_uri ( const char *uri_string ) {
 		uri->port = tmp;
 	}
 
+ decode:
 	/* Decode fields that should be decoded */
 	for ( i = URI_FIRST_FIELD; i <= URI_LAST_FIELD; i++ ) {
 		const char *field = uri_get_field ( uri, i );
-- 
1.7.0.4



More information about the gPXE-devel mailing list