basic/source/runtime/methods.cxx |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit 73dc528db8418720cdab81cfaf5a1589693a3e90
Author:     Alin Andrei Abahnencei <alinandrei2...@gmail.com>
AuthorDate: Mon Dec 23 10:54:07 2024 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Jan 9 13:18:16 2025 +0100

    tdf#154285 Check upper bound of arguments in SbRtl_Month function
    
    Signed-off-by: Alin Andrei Abahnencei <alinandrei2...@gmail.com>
    Change-Id: Ifc27af0f091c75c02d3816b83b3717fc435ad31b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179250
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3c353bdd4256..0c2b7c298cae 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2065,15 +2065,10 @@ void SbRtl_Minute(StarBASIC *, SbxArray & rPar, bool)
 
 void SbRtl_Month(StarBASIC *, SbxArray & rPar, bool)
 {
-    if (rPar.Count() < 2)
-    {
-        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-    }
-    else
-    {
-        sal_Int16 nMonth = implGetDateMonth(rPar.Get(1)->GetDate());
-        rPar.Get(0)->PutInteger(nMonth);
-    }
+    if (rPar.Count() != 2)
+        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+    sal_Int16 nMonth = implGetDateMonth(rPar.Get(1)->GetDate());
+    rPar.Get(0)->PutInteger(nMonth);
 }
 
 sal_Int16 implGetSecond( double dDate )

Reply via email to