diff options
author | Alin Andrei Abahnencei <alinandrei2004@gmail.com> | 2024-12-23 10:56:39 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2025-01-09 13:19:13 +0100 |
commit | 7419fc569f07fbd5685a6e58439b681a52fdd045 (patch) | |
tree | a120c96353c1d8f06421bcfe7f521cb3c6651756 | |
parent | 73dc528db8418720cdab81cfaf5a1589693a3e90 (diff) |
tdf#154285 Check upper bound of arguments in SbRtl_Hour function
Signed-off-by: Alin Andrei Abahnencei <alinandrei2004@gmail.com>
Change-Id: Ib372b4dfde77961e7982bd0d8f1f8598be7da726
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179252
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | basic/source/runtime/methods.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 0c2b7c298cae..899a79cd90d5 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2042,16 +2042,11 @@ sal_Int16 implGetHour( double dDate ) void SbRtl_Hour(StarBASIC *, SbxArray & rPar, bool) { - if (rPar.Count() < 2) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } - else - { - double nArg = rPar.Get(1)->GetDate(); - sal_Int16 nHour = implGetHour( nArg ); - rPar.Get(0)->PutInteger(nHour); - } + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + double nArg = rPar.Get(1)->GetDate(); + sal_Int16 nHour = implGetHour( nArg ); + rPar.Get(0)->PutInteger(nHour); } void SbRtl_Minute(StarBASIC *, SbxArray & rPar, bool) |