aboutsummaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-09-23 17:23:54 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-09-23 17:23:54 +0200
commit5e859bae099245af0b9a95b6c45059863153b95f (patch)
tree9fd8281728f111ee40774ee808de3694cab2a8a9 /src/util/util.c
parent389b5de09dc3720c22ac86d5cad4c1495fc5be58 (diff)
make URL joining more restrictive to avoid mistakes
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 75ace4dcf..027daf427 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -300,6 +300,15 @@ TALER_url_join (const char *base_url,
va_list args;
GNUNET_assert (NULL != res);
+ GNUNET_assert (NULL != base_url);
+ GNUNET_assert (NULL != path);
+ GNUNET_assert (strlen (base_url) > 0);
+
+ // Must be an actual base URL!
+ GNUNET_assert ('/' == base_url[strlen (base_url) - 1]);
+
+ // Path must be relative to existing path of base URL
+ GNUNET_assert ('/' != path[0]);
grow_string (&res, base_url, &n);