[jsonapi] Check for empty "uris" parameter in queue/items/add (prevents

a segfault) and log failed requests in error log
This commit is contained in:
chme 2018-12-30 08:33:31 +01:00
parent e3b0442fc7
commit b3853ef0f3

View File

@ -1762,6 +1762,12 @@ queue_tracks_add_byuris(const char *param, int pos, int *total_count)
*total_count = 0;
if (strlen(param) == 0)
{
DPRINTF(E_LOG, L_WEB, "Empty query parameter 'uris'\n");
return -1;
}
uris = strdup(param);
uri = strtok(uris, ",");
@ -3255,6 +3261,9 @@ jsonapi_request(struct evhttp_request *req, struct httpd_uri_parsed *uri_parsed)
status_code = hreq->handler(hreq);
if (status_code >= 400)
DPRINTF(E_LOG, L_WEB, "JSON api request failed with error code %d (%s)\n", status_code, uri_parsed->uri);
switch (status_code)
{
case HTTP_OK: /* 200 OK */