diff options
author | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2016-01-07 03:21:29 +0000 |
---|---|---|
committer | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2016-01-07 03:21:29 +0000 |
commit | 018837064d616decd74228f706525e42a904641c (patch) | |
tree | 59e5d26c93e450608c3b9364bc66941f2ce21628 /sys/dev/ipmi.c | |
parent | e15033ceaf8fb209afd46fdf0bf6b0b49ee6dd46 (diff) |
Copy received data only if it exists. Avoid panics in odd situations.
Diffstat (limited to 'sys/dev/ipmi.c')
-rw-r--r-- | sys/dev/ipmi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index be02ca979b5..f7586cd2bbd 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.77 2015/09/08 11:58:58 deraadt Exp $ */ +/* $OpenBSD: ipmi.c,v 1.78 2016/01/07 03:21:28 uebayasi Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -1112,7 +1112,8 @@ get_sdr_partial(struct ipmi_softc *sc, u_int16_t recordId, u_int16_t reserveId, } if (nxtRecordId) *nxtRecordId = *(uint16_t *) cmd; - memcpy(buffer, cmd + 2, len - 2); + if (len > 2) + memcpy(buffer, cmd + 2, len - 2); return (0); } |