prevent crash on incomplete request to old API
Costa Tsaousis committed
Nov 18, 2016 at 19:38 UTC
9eb45e37216e8d470a4ffc0e7bd540476b13661b
1 file changed
+6
src/web_client.c
+6
@@ -1494,6 +1494,12 @@ int web_client_api_request(struct web_client *w, char *url)
1494
1495
int web_client_api_old_data_request(struct web_client *w, char *url, int datasource_type)
1496
{
1497
+ if(!url || !*url) {
1498
+ buffer_flush(w->response.data);
1499
+ buffer_sprintf(w->response.data, "Incomplete request.");
1500
+ return 400;
1501
+ }
1502
+
1503
RRDSET *st = NULL;
1504
1505
char *args = strchr(url, '?');