提交 68edbce4 编写于 作者: J Joern Engel 提交者: Nicholas Bellinger

target: fix pr_out length in iscsi_parse_pr_out_transport_id

Old code in iscsi_parse_pr_out_transport_id() was obviously buggy
and effectively ignored the high byte.

Found by coverity.
Signed-off-by: NJoern Engel <joern@logfs.org>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 1481473b
...@@ -394,9 +394,9 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -394,9 +394,9 @@ char *iscsi_parse_pr_out_transport_id(
* If the caller wants the TransportID Length, we set that value for the * If the caller wants the TransportID Length, we set that value for the
* entire iSCSI Tarnsport ID now. * entire iSCSI Tarnsport ID now.
*/ */
if (out_tid_len != NULL) { if (out_tid_len) {
add_len = ((buf[2] >> 8) & 0xff); /* The shift works thanks to integer promotion rules */
add_len |= (buf[3] & 0xff); add_len = (buf[2] << 8) | buf[3];
tid_len = strlen(&buf[4]); tid_len = strlen(&buf[4]);
tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ tid_len += 4; /* Add four bytes for iSCSI Transport ID header */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册