aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-06 21:52:10 +0200
committerMax Kellermann <max@duempel.org>2009-07-06 21:52:10 +0200
commitd3b5574d7aac0a7f2d4eb785facfad9f37c15dd5 (patch)
tree9255929810567b241a34b7c2c77479c49271b99a /src/command.c
parent90472526e00c671f76d78341b5e474fcf069d41e (diff)
downloadmpd-d3b5574d7aac0a7f2d4eb785facfad9f37c15dd5.tar.gz
mpd-d3b5574d7aac0a7f2d4eb785facfad9f37c15dd5.tar.xz
mpd-d3b5574d7aac0a7f2d4eb785facfad9f37c15dd5.zip
volume: moved range check to handle_setvol()
Converted the range checks in volume_level_change() to assertions. Changed all volume types to "unsigned", expect for those which must be able to indicate error (-1).
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 9f725edf1..dda75a1b3 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1061,6 +1061,11 @@ handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
if (!check_int(client, &level, argv[1], need_integer))
return COMMAND_RETURN_ERROR;
+ if (level < 0 || level > 100) {
+ command_error(client, ACK_ERROR_ARG, "Invalid volume value");
+ return COMMAND_RETURN_ERROR;
+ }
+
success = volume_level_change(level);
if (!success) {
command_error(client, ACK_ERROR_SYSTEM,