tipc: fix out of bounds indexing
authorErik Hugne <erik.hugne@ericsson.com>
Mon, 28 Apr 2014 06:20:09 +0000 (08:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Apr 2014 18:43:35 +0000 (14:43 -0400)
commitd7bb74c38cb3de40600dcbba50a4f84df290dc91
treec8c320eb97da04533e2c8e7f1e81bb4f3ee92376
parentd37556eb1cb76b5e2320fc1ea94dfab29fce878c
tipc: fix out of bounds indexing

Commit 78acb1f9b898e85fa2c1e28e700b54b66b288e8d ("tipc: add
ioctl to fetch link names") introduced a buffer overflow bug where
specially crafted ioctl requests could cause out-of-bounds indexing
of the node->links array. This was caused by an incorrect check vs
MAX_BEARERS, and the static code checker complaint is:
net/tipc/node.c:459 tipc_node_get_linkname() error: buffer overflow 'node->links' 2 <= 2

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/node.c