diff options
author | 2015-09-11 10:19:05 +0000 | |
---|---|---|
committer | 2015-09-11 10:19:05 +0000 | |
commit | ecca1b208f5c0697ed63fa8975ddcf49a7166a86 (patch) | |
tree | 66e22075ba35106bca9dd43616669e02bb2e4a08 /sys/dev/pci/qle.c | |
parent | if_put after if_get. (diff) | |
download | wireguard-openbsd-ecca1b208f5c0697ed63fa8975ddcf49a7166a86.tar.xz wireguard-openbsd-ecca1b208f5c0697ed63fa8975ddcf49a7166a86.zip |
Don't copy more sense data than we have space for, so we don't crash when
trying to talk to a Sun STK6140. Still doesn't work though.
ok dlg@
Diffstat (limited to 'sys/dev/pci/qle.c')
-rw-r--r-- | sys/dev/pci/qle.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/pci/qle.c b/sys/dev/pci/qle.c index e6b8eb0b4b0..ea9032422cd 100644 --- a/sys/dev/pci/qle.c +++ b/sys/dev/pci/qle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qle.c,v 1.37 2015/09/06 04:54:44 deraadt Exp $ */ +/* $OpenBSD: qle.c,v 1.38 2015/09/11 10:19:05 jmatthew Exp $ */ /* * Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org> @@ -1101,8 +1101,9 @@ qle_handle_resp(struct qle_softc *sc, u_int32_t id) int sr; data = status->data + lemtoh32(&status->fcp_rsp_len); - memcpy(&xs->sense, data, - lemtoh32(&status->fcp_sense_len)); + sr = MIN(lemtoh32(&status->fcp_sense_len), + sizeof(xs->sense)); + memcpy(&xs->sense, data, sr); xs->error = XS_SENSE; pp = (u_int32_t *)&xs->sense; for (sr = 0; sr < sizeof(xs->sense)/4; sr++) { |