Skip to content

Commit 7e78c59

Browse files
Xiaolong Huangdavem330
authored andcommitted
net: qrtr: fix another OOB Read in qrtr_endpoint_post
This check was incomplete, did not consider size is 0: if (len != ALIGN(size, 4) + hdrlen) goto err; if size from qrtr_hdr is 0, the result of ALIGN(size, 4) will be 0, In case of len == hdrlen and size == 0 in header this check won't fail and if (cb->type == QRTR_TYPE_NEW_SERVER) { /* Remote node endpoint can bridge other distant nodes */ const struct qrtr_ctrl_pkt *pkt = data + hdrlen; qrtr_node_assign(node, le32_to_cpu(pkt->server.node)); } will also read out of bound from data, which is hdrlen allocated block. Fixes: 194ccc8 ("net: qrtr: Support decoding incoming v2 packets") Fixes: ad9d24c ("net: qrtr: fix OOB Read in qrtr_endpoint_post") Signed-off-by: Xiaolong Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a8f89fa commit 7e78c59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/qrtr/qrtr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
493493
goto err;
494494
}
495495

496-
if (len != ALIGN(size, 4) + hdrlen)
496+
if (!size || len != ALIGN(size, 4) + hdrlen)
497497
goto err;
498498

499499
if (cb->dst_port != QRTR_PORT_CTRL && cb->type != QRTR_TYPE_DATA &&

0 commit comments

Comments
 (0)