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
This commit is contained in:
Adam Seskunas 2024-02-08 21:41:13 -08:00 committed by Mike Kaganski
parent 5121c1f8a3
commit 95dace2eb1

View file

@ -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)