From f80effb1fcca67fb79f7c1afd97191ee9e7b81a7 Mon Sep 17 00:00:00 2001 From: Pavel Kiryukhin Date: Mon, 10 Feb 2020 16:40:22 +0300 Subject: sel: time: fix null pointer dereference in set This is a refix of commit f0d5c17e --- lib/ipmi_sel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c index 8b3d161..b6b8da1 100644 --- a/lib/ipmi_sel.c +++ b/lib/ipmi_sel.c @@ -2743,6 +2743,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string) struct ipmi_rs *rsp; struct ipmi_rq req; struct tm tm = {0}; + uint8_t msg_data[4] = {0}; time_t t; const char *time_format = "%x %X"; /* Use locale-defined format */ @@ -2787,8 +2788,9 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string) * At this point `t` is UTC. Convert it to LE and send. */ + req.msg.data = msg_data; htoipmi32(t, req.msg.data); - req.msg.data_len = 4; + req.msg.data_len = sizeof(msg_data); rsp = intf->sendrecv(intf, &req); if (!rsp || rsp->ccode) { -- cgit v1.2.1