cec: return false when SetHDMIPort() is called with invalid arguments
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 27 Apr 2012 11:43:47 +0000 (13:43 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 27 Apr 2012 11:43:47 +0000 (13:43 +0200)
src/lib/CECProcessor.cpp

index 51fb764c40f5ac88f35c750e2f114a09acdf10d0..5ea6bd5de62d9501daded2a4b64db06d491781fb 100644 (file)
@@ -607,10 +607,9 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort,
   bool bReturn(false);
 
   // limit the HDMI port range to 1-15
-  if (iPort < 1)
-      iPort = 1;
-  if (iPort > 15)
-      iPort = 15;
+  if (iPort < CEC_MIN_HDMI_PORTNUMBER ||
+      iPort > CEC_MAX_HDMI_PORTNUMBER)
+    return bReturn;
 
   {
     CLockObject lock(m_mutex);