]> git.michaelhowe.org Git - packages/o/openafs.git/commit
vos: Don't leak/overflow bulkaddrs
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 31 May 2011 07:28:51 +0000 (08:28 +0100)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 11:02:42 +0000 (03:02 -0800)
commit5fb00398ef02bf453195a0bc50f5df95788557c7
tree2281cc4ea8d1d2c1fbd17bdac0db7afc0694bbad
parent81d44944794748ff3211158d3a1c0c9746100b8e
vos: Don't leak/overflow bulkaddrs

The vos listaddrs command repeatedly reuses a bulkaddrs array. It
zeros it once (without freeing the allocated memory), and then
repeatedly uses it without zeroing in a loop. This means that the XDR
library assumes that a sufficiently large block is already allocated,
doesn't reallocate for the incoming data, or check limits.

This means that if the first call to VL_GetAddrsU returns a set of
addresses smaller than subsequent calls, we'll write past the end
of the array, causing memory corruption.

Fix this by freeing the arrays correctly with each pass of the call.

Reviewed-on: http://gerrit.openafs.org/4756
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b6add117ad210665a811213fe17a30fabbda3a3c)

Change-Id: Ic3ae8f506e87d18fdc121ff21221f61c359e38aa
Reviewed-on: http://gerrit.openafs.org/6302
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/volser/vos.c