From 9fe45af2f4c229d6a9f701290dfdad5045566b5d Mon Sep 17 00:00:00 2001 From: Olivier FAURAX Date: Thu, 14 Sep 2023 10:48:12 +0200 Subject: [PATCH] providers/redfish/firmware: check size before accessing element --- providers/redfish/firmware.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/providers/redfish/firmware.go b/providers/redfish/firmware.go index 258c2289..c3486c44 100644 --- a/providers/redfish/firmware.go +++ b/providers/redfish/firmware.go @@ -145,7 +145,11 @@ func TaskIDFromLocationURI(uri string) (taskID string, err error) { // OpenBMC returns a monitor URL in Location // Location: /redfish/v1/TaskService/Tasks/12/Monitor splits := strings.Split(uri, "/") - taskID = splits[5] + if len(splits) == 6 { + taskID = splits[5] + } else { + taskID = "" + } } if taskID == "" {