mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-01 18:21:31 -04:00
[jsonapi] Check for empty playlist name in queue/save
This commit is contained in:
parent
3650a7573f
commit
4434fe7a2c
@ -2917,9 +2917,9 @@ static int
|
|||||||
jsonapi_reply_queue_save(struct httpd_request *hreq)
|
jsonapi_reply_queue_save(struct httpd_request *hreq)
|
||||||
{
|
{
|
||||||
const char *param;
|
const char *param;
|
||||||
int ret = 0;
|
|
||||||
char buf[PATH_MAX+7];
|
char buf[PATH_MAX+7];
|
||||||
char *plsname = NULL;
|
char *playlist_name = NULL;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if ((param = evhttp_find_header(hreq->query, "name")) == NULL)
|
if ((param = evhttp_find_header(hreq->query, "name")) == NULL)
|
||||||
{
|
{
|
||||||
@ -2939,9 +2939,17 @@ jsonapi_reply_queue_save(struct httpd_request *hreq)
|
|||||||
return 403;
|
return 403;
|
||||||
}
|
}
|
||||||
|
|
||||||
plsname = atrim(param);
|
playlist_name = atrim(param);
|
||||||
snprintf(buf, PATH_MAX+7, "/file:%s/%s", default_pl_dir, plsname);
|
|
||||||
free(plsname);
|
if (strlen(playlist_name) < 1) {
|
||||||
|
free(playlist_name);
|
||||||
|
|
||||||
|
DPRINTF(E_LOG, L_WEB, "Empty playlist name parameter is not allowed\n");
|
||||||
|
return HTTP_BADREQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "/file:%s/%s", default_pl_dir, playlist_name);
|
||||||
|
free(playlist_name);
|
||||||
|
|
||||||
ret = library_queue_save(buf);
|
ret = library_queue_save(buf);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user