]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix unbounded-length malloc, controlled from usermode. The added check
authorKonstantin Belousov <kib@FreeBSD.org>
Thu, 21 Jun 2012 09:20:07 +0000 (09:20 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Thu, 21 Jun 2012 09:20:07 +0000 (09:20 +0000)
commit7aac7bc18a25e8bf1a7e32ab28e5faf5b99a536b
tree01adac257d485894b5ea4edc255ff795afc07789
parent854c3ce7ac25597160a6a9804667800362023435
Fix unbounded-length malloc, controlled from usermode. The added check
is performed before exact size of the buffer is calculated, but the
buffer cannot have size greater then the total space allocated for
extended attributes. The existing check is executing with precise
size, but it is too late, since buffer needs to be allocated in
advance.

Also, adapt to uio_resid being of ssize_t type.  Use lblktosize instead of
multiplying by fs block size by hand as well.

Reported and tested by:   pho
MFC after:   1 week
sys/ufs/ffs/ffs_vnops.c