diff options
author | Pavel Kiryukhin <vksavl@gmail.com> | 2020-02-10 16:40:22 +0300 |
---|---|---|
committer | Alexander Amelkin <mocbuhtig@amelkin.msk.ru> | 2020-02-12 16:37:02 +0300 |
commit | f80effb1fcca67fb79f7c1afd97191ee9e7b81a7 (patch) | |
tree | 57d9d4df9cbfa1f80a6f65ca54f047a8c92aa84e | |
parent | 7ccea283dd62a05a320c1921e3d8d71a87772637 (diff) | |
download | ipmitool-f80effb1fcca67fb79f7c1afd97191ee9e7b81a7.tar.gz |
sel: time: fix null pointer dereference in set
This is a refix of commit f0d5c17e
-rw-r--r-- | lib/ipmi_sel.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) { |