]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
af_unix: Add sockaddr length checks before accessing sa_family in bind and connect...
authorMateusz Jurczyk <mjurczyk@google.com>
Thu, 8 Jun 2017 09:13:36 +0000 (11:13 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 19 Jul 2017 07:58:37 +0000 (09:58 +0200)
commitfd4df377dd7f3a78e3d60517d480db95d5faf891
tree2f931dec4e143de2a985db2b2708e7a17baaaf73
parenta875ed44c39f128fca6787b6bf20746974b50ca0
af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers

BugLink: http://bugs.launchpad.net/bugs/1702863
[ Upstream commit defbcf2decc903a28d8398aa477b6881e711e3ea ]

Verify that the caller-provided sockaddr structure is large enough to
contain the sa_family field, before accessing it in bind() and connect()
handlers of the AF_UNIX socket. Since neither syscall enforces 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: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
net/unix/af_unix.c