NFC: Add sockaddr length checks before accessing sa_family in bind handlers
authorMateusz Jurczyk <mjurczyk@google.com>
Tue, 13 Jun 2017 16:44:28 +0000 (18:44 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 22 Jun 2017 22:38:31 +0000 (00:38 +0200)
commitf6a5885fc4d68e7f25ffb42b9d8d80aebb3bacbb
tree829ed516b1f0f3eb98c27cebeaca12eaa11664f6
parent6f874bafacf053b87887f4149fc117e2b1096138
NFC: Add sockaddr length checks before accessing sa_family in bind handlers

Verify that the caller-provided sockaddr structure is large enough to
contain the sa_family field, before accessing it in bind() handlers of the
AF_NFC socket. Since the syscall doesn't enforce a minimum size of the
corresponding memory region, very short sockaddrs (zero or one byte long)
result in operating on uninitialized memory while referencing .sa_family.

Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/llcp_sock.c