diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-11-17 15:22:37 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-11-20 12:16:55 +0100 |
commit | 99b8559471c4429df70803cdb358da41888f8d03 (patch) | |
tree | 79cad3012a34005e0a1569562bebeb0d32dede26 | |
parent | 5deeb28a32146b0de887a4eb6fb3e23cb2f4549b (diff) |
sd: remote: check that received commands have expected arguments
Change-Id: If4b5fe0362a40d14d68829bffb79f91ae9745835
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159590
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 8d87164becccc230e1e0ad5ac51bf645744165a2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159578
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 48d79e437d44..0846f5bbbe94 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -77,6 +77,12 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) { } + if (aCommand.empty()) + { + SAL_WARN("sdremote", "Receiver::executeCommand: no command"); + return; + } + if ( aCommand[0] == "transition_next" ) { if ( xSlideShowController.is() ) @@ -89,6 +95,11 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) } else if ( aCommand[0] == "goto_slide" ) { + if (aCommand.size() < 2) + { + SAL_WARN("sdremote", "Receiver::executeCommand: invalid goto_slide"); + return; + } // FIXME: if 0 returned, then not a valid number sal_Int32 aSlide = aCommand[1].toInt32(); if ( xSlideShowController.is() && @@ -121,6 +132,11 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) } else if (aCommand[0] == "pointer_started" ) { + if (aCommand.size() < 3) + { + SAL_WARN("sdremote", "Receiver::executeCommand: invalid pointer_started"); + return; + } // std::cerr << "pointer_started" << std::endl; float x = aCommand[1].toFloat(); float y = aCommand[2].toFloat(); @@ -175,6 +191,11 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand ) } else if (aCommand[0] == "pointer_coordination" ) { + if (aCommand.size() < 3) + { + SAL_WARN("sdremote", "Receiver::executeCommand: invalid pointer_coordination"); + return; + } float x = aCommand[1].toFloat(); float y = aCommand[2].toFloat(); |