mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 15:45:56 -05:00
[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:
parent
e3b0442fc7
commit
b3853ef0f3
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user