basic/source/runtime/methods.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit b22f9843e6801621538e132ad332f1870e2bef16
Author:     Simon Chenery <[email protected]>
AuthorDate: Sat Feb 8 20:42:48 2025 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Feb 9 08:56:38 2025 +0100

    tdf#154285 Check correct number of arguments to SbRtl_Now function
    
    If BASIC function NOW is called with the wrong number of arguments,
    then return error code 5 (Invalid procedure call).
    
    Change-Id: I123f316e36e6726a2cfc9d1e53664ce632af1289
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181303
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 0af3c82369cf..d9cdd59cd053 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2074,7 +2074,13 @@ double Now_Impl()
 
 // Date Now()
 
-void SbRtl_Now(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutDate(Now_Impl()); }
+void SbRtl_Now(StarBASIC*, SbxArray& rPar, bool)
+{
+    if (rPar.Count() != 1)
+        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+    rPar.Get(0)->PutDate(Now_Impl());
+}
 
 // Date Time()
 

Reply via email to