util: Avoid overflow in GetNameByINet
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 2 Mar 2013 10:27:47 +0000 (10:27 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 10 Mar 2013 03:14:31 +0000 (19:14 -0800)
commitfcb7974b838c2b37a8b81b88b11905c6ece398f6
tree1ae8c96e801fcbb7cf02343f8839a7e143e8d698
parentcc194827a841f057654f1dbe4dcb3f6de98c1c60
util: Avoid overflow in GetNameByINet

We copy the results of gethostbyaddr into a fixed length buffer
without checking whether they fit. Add a length check, and use
strlcpy to do the copy to make sure we can't overflow.

Caught by coverity (#985912, #985872)

Change-Id: I1e8f0fbb2577199c25201940f54646a4acdbbd37
Reviewed-on: http://gerrit.openafs.org/9393
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/util/hostparse.c