auth: Make sure we get AF_INET addresses from DNS
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 31 Mar 2012 16:20:25 +0000 (12:20 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 9 Apr 2012 01:19:57 +0000 (18:19 -0700)
commitde94f97649cbf36a5d8ae805a0d211573fcb11be
tree0a04dcacf9b8c34e03108144a073af79e3119c44
parent20265ddd78dbe4a7777b17912f2c3f00dbf2a1db
auth: Make sure we get AF_INET addresses from DNS

The routines which do AFSDB and SRV lookups copy the results of
gethostbyname directly into an afs_int32, and use the size of the
result to limit the copy. If, for any reason, they get a result that
isn't an int, then they will overflow this value.

Check that the result we get from gethostbyname is in the INET
address family, and also limit the size of the copy by the size of the
destination, rather than that of the source.

Caught by clang-analyzer

Change-Id: Icf1426e090bc1ed382212d5de6c291d0816fb2c9
Reviewed-on: http://gerrit.openafs.org/7096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/auth/cellconfig.c