summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAdam Seskunas <adamseskunas@gmail.com>2024-02-08 21:41:13 -0800
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-13 05:51:04 +0100
commit95dace2eb1ae7ce2fc000cc67e134b7bfadf2c35 (patch)
treeea65c4c18a58323d477543de0f1a002d303d7540 /basic
parent5121c1f8a3dc1e326a4195393f463f5c0383859b (diff)
tdf#154285 Check upper bound of arguments in SbRtl_CurDir
The LibreOffice Basic specification says CurDir should accept one argument and in the case of a non-Windows system, ignore that argument and simply return the current directory. So check that SbRtl_CurDir accepts a maximum of two arguments. Change-Id: Ia60114fac31aa4261c8251e26ef172a0370e6abc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163150 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index d58a2cef9ee0..34d959669747 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -371,6 +371,9 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
// there's no possibility to detect the current one in a way that a virtual URL
// could be delivered.
+ if (rPar.Count() > 2)
+ return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
#if defined(_WIN32)
int nCurDir = 0; // Current dir // JSM
if (rPar.Count() == 2)