bos: Remove theoretical overflow in DateOf
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 8 Mar 2013 16:15:51 +0000 (16:15 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 12 Mar 2013 13:51:49 +0000 (06:51 -0700)
commit8b76110e23160e33716234f9560d22ca5275cb0a
tree350820aad0bafbd2e2e9f9d5ba9dffff049aff09
parent4e9c6eb9d5192888d79a07042c9cb6029def9726
bos: Remove theoretical overflow in DateOf

DateOf copies the results of ctime into a static buffer. Typically
ctime will return a 26 byte string, but if you pass it a year larger
than 9999 (which we shouldn't), you can get a 32 (or more) byte string.

Get rid of this unlikely event by using strlcpy for the copy. We already
truncate at 24 bytes when we remove the \n, so this shouldn't cause any
further problems.

Really, this whole thing should be rewritten to use strftime.

Caught by coverity (#985776)

Change-Id: I18f6828d6ec3d79ecaf1dad8e27d3e8691ce87d5
Reviewed-on: http://gerrit.openafs.org/9551
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/bozo/bos.c