From 5b09363597d9586ec421817459efe8a242c953c8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 Jul 2015 17:43:21 +0100 Subject: Add asserts to ensure operations not passed bad pointers --- utils/nsurl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/nsurl.c b/utils/nsurl.c index 9e19275cc..8431916be 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -1554,6 +1554,8 @@ nserror nsurl_get(const nsurl *url, nsurl_component parts, struct nsurl_component_lengths str_len = { 0, 0, 0, 0, 0, 0, 0, 0 }; enum nsurl_string_flags str_flags = 0; + assert(url != NULL); + /* Get the string length and find which parts of url need copied */ nsurl__get_string_data(&(url->components), parts, url_l, &str_len, &str_flags); @@ -1704,6 +1706,8 @@ const char *nsurl_access_leaf(const nsurl *url) const char *path; const char *leaf; + assert(url != NULL); + if (url->components.path == NULL) return ""; -- cgit v1.2.3