basic/source/runtime/methods.cxx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
New commits: commit 633a787707786de7a535070efbd81781430395e7 Author: Alin Andrei Abahnencei <[email protected]> AuthorDate: Mon Dec 23 10:58:57 2024 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jan 9 13:17:02 2025 +0100 tdf#154285 Check upper bound of arguments in SbRtl_Day function Signed-off-by: Alin Andrei Abahnencei <[email protected]> Change-Id: Ic22d420f0f5596ea3a4ff9cd7e540e6c51a559ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179254 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 17b9029b9d72..3c353bdd4256 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2015,18 +2015,13 @@ void SbRtl_TimeValue(StarBASIC *, SbxArray & rPar, bool) void SbRtl_Day(StarBASIC *, SbxArray & rPar, bool) { - if (rPar.Count() < 2) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } - else - { - SbxVariableRef pArg = rPar.Get(1); - double aDate = pArg->GetDate(); + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + SbxVariableRef pArg = rPar.Get(1); + double aDate = pArg->GetDate(); - sal_Int16 nDay = implGetDateDay( aDate ); - rPar.Get(0)->PutInteger(nDay); - } + sal_Int16 nDay = implGetDateDay( aDate ); + rPar.Get(0)->PutInteger(nDay); } void SbRtl_Year(StarBASIC *, SbxArray & rPar, bool)
