basic/source/runtime/methods.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit 95dace2eb1ae7ce2fc000cc67e134b7bfadf2c35 Author: Adam Seskunas <adamsesku...@gmail.com> AuthorDate: Thu Feb 8 21:41:13 2024 -0800 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Feb 13 05:51:04 2024 +0100 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.kagan...@collabora.com> Tested-by: Jenkins 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)