mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
[mpd] Check upper bound for sticker 'rating'
This commit is contained in:
parent
7a916c84a2
commit
7b04787fc1
2
src/db.h
2
src/db.h
@ -72,6 +72,8 @@ enum query_type {
|
||||
#define DB_ADMIN_LASTFM_SESSION_KEY "lastfm_sk"
|
||||
#define DB_ADMIN_SPOTIFY_REFRESH_TOKEN "spotify_refresh_token"
|
||||
|
||||
#define DB_FILES_RATING_MAX 100
|
||||
|
||||
struct query_params {
|
||||
/* Query parameters, filled in by caller */
|
||||
enum query_type type;
|
||||
|
@ -3301,6 +3301,12 @@ mpd_sticker_set(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, co
|
||||
}
|
||||
|
||||
rating *= MPD_RATING_FACTOR;
|
||||
if (rating > DB_FILES_RATING_MAX)
|
||||
{
|
||||
*errmsg = safe_asprintf("rating '%s' is greater than maximum value allowed", argv[5], (DB_FILES_RATING_MAX / MPD_RATING_FACTOR));
|
||||
return ACK_ERROR_ARG;
|
||||
}
|
||||
|
||||
ret = db_file_rating_update_byvirtualpath(virtual_path, rating);
|
||||
if (ret <= 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user