OSDN Git Service

NFC: llcp: integer underflow in nfc_llcp_set_remote_gb()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 31 Jan 2013 08:16:46 +0000 (11:16 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 8 Feb 2013 19:51:31 +0000 (14:51 -0500)
commite9a4aa3ba386c8a368baaadde6f9e5c3d5f17cfe
tree5a92893b34d4d7ef1f1913c1113fbe5999b2e65b
parentc6d3b2046e310b361da93fe6c44bde5522c782da
NFC: llcp: integer underflow in nfc_llcp_set_remote_gb()

If gb_len is less than 3 it would cause an integer underflow and
possibly memory corruption in nfc_llcp_parse_gb_tlv().

I removed the old test for gb_len == 0.  I also removed the test for
->remote_gb == NULL.  It's not possible for ->remote_gb to be NULL and
we have already dereferenced ->remote_gb_len so it's too late to test.

The old test return -ENODEV but my test returns -EINVAL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/nfc/llcp/llcp.c