summaryrefslogtreecommitdiffstats
path: root/src/core/uri.c
diff options
context:
space:
mode:
authorPiotr JaroszyƄski2010-04-12 17:15:44 +0200
committerMichael Brown2010-04-25 18:21:49 +0200
commit4cb0bfe2916eb4252a38bdb300fb59619c5d9f9b (patch)
tree100d72939b5527cb1e2c742a238fc321302ec10c /src/core/uri.c
parent[romprefix] Add .mrom format, allowing loading of large ROMs (diff)
downloadipxe-4cb0bfe2916eb4252a38bdb300fb59619c5d9f9b.tar.gz
ipxe-4cb0bfe2916eb4252a38bdb300fb59619c5d9f9b.tar.xz
ipxe-4cb0bfe2916eb4252a38bdb300fb59619c5d9f9b.zip
[uri] Fix NULL dereference in parse_uri()
Don't try to parse authority if it's not there. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/uri.c')
-rw-r--r--src/core/uri.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/uri.c b/src/core/uri.c
index 57502f26..ff49e47a 100644
--- a/src/core/uri.c
+++ b/src/core/uri.c
@@ -74,8 +74,8 @@ struct uri * parse_uri ( const char *uri_string ) {
struct uri *uri;
char *raw;
char *tmp;
- char *path = NULL;
- char *authority = NULL;
+ char *path;
+ char *authority;
int i;
size_t raw_len;
@@ -110,6 +110,7 @@ struct uri * parse_uri ( const char *uri_string ) {
} else {
/* Absolute URI with opaque part */
uri->opaque = tmp;
+ path = NULL;
}
} else {
/* Relative URI */
@@ -148,8 +149,15 @@ struct uri * parse_uri ( const char *uri_string ) {
} else {
/* Absolute/relative path */
uri->path = path;
+ authority = NULL;
}
+ /* If we don't have an authority (i.e. we have a non-net
+ * path), we're already finished processing
+ */
+ if ( ! authority )
+ goto done;
+
/* Split authority into user[:password] and host[:port] portions */
if ( ( tmp = strchr ( authority, '@' ) ) ) {
/* Has user[:password] */