core: Add extra checks for Mute and Volume
authorJens Georg <mail@jensge.org>
Fri, 11 May 2012 11:55:00 +0000 (13:55 +0200)
committerJens Georg <mail@jensge.org>
Mon, 28 May 2012 17:11:58 +0000 (19:11 +0200)
src/rygel/rygel-rendering-control.vala

index b50240f..35ebce8 100644 (file)
@@ -204,6 +204,14 @@ internal class Rygel.RenderingControl : Service {
             return;
         }
 
+        string mute_str;
+        action.get ("DesiredMute", typeof (string), out mute_str);
+        if (mute_str.has_prefix ("-")) {
+            action.return_error (501, _("ActionFailed"));
+
+            return;
+        }
+
         bool mute;
 
         action.get ("DesiredMute", typeof (bool), out mute);
@@ -238,6 +246,14 @@ internal class Rygel.RenderingControl : Service {
             return;
         }
 
+        string volume_str;
+        action.get ("DesiredVolume", typeof (string), out volume_str);
+        if ("." in volume_str || "," in volume_str) {
+            action.return_error (501, _("ActionFailed"));
+
+            return;
+        }
+
         uint volume;
 
         action.get ("DesiredVolume", typeof (uint), out volume);