Whamcloud - gitweb
misc: fix problems with strncat
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 18 Jul 2014 22:54:07 +0000 (15:54 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Jul 2014 11:21:47 +0000 (07:21 -0400)
commitc3470fcd60be3b47f077dbddf6c6e7246903c27b
tree2f3eb59f928da436d4ae20a9c3490062562846d5
parent203e13cf9cf0754efd1e322885b2099fa43cb3fa
misc: fix problems with strncat

The third argument to strncat is the maximum number of characters to
copy out of the second argument; it is not the maximum length of the
first argument.

Therefore, code in a check just in case we ever find a /sys/block/X
path long enough to hit the end of the buffer.  FWIW the longest path
I could find on my machine was 133 bytes.

Fixes-Coverity-Bug: 1252003
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mk_hugefiles.c