cec: return false when SetHDMIPort() is called with invalid arguments
[deb_libcec.git] / 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);