]> git.michaelhowe.org Git - packages/o/openafs.git/commit
Unix CM: Fix hash table overflow in dnlc code
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 28 Feb 2013 15:26:15 +0000 (15:26 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 13:02:04 +0000 (06:02 -0700)
commit0c1815b37a27a609892a553005da2305a5779a1e
tree77a5f790b5017b66ed677919d7c4f46dbf835fde
parent393043f6dbfdd684b14281fbe568c14c0e11a15c
Unix CM: Fix hash table overflow in dnlc code

In GetMeAnEntry, we can end up overflowing the nameHash array by one
element if the stars are particularly badly aligned.

nameptr is a static across function calls, so nameptr and j are not
equal. If nameptr is increment to NHSIZE in the same loop iteration
as j reaches NHSIZE + 2, the loop will terminate. We'll then
lookup nameHash[NHSIZE], which is 1 element passed the end of the
array.

Add an if statement which loops nameptr outside the loop (in the
same way as the if statement in the loop)

Caught by coverity (#985568)

Reviewed-on: http://gerrit.openafs.org/9312
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit d2437d02a6f59d972dd0690f7eb1c46cf7cc4b85)

Change-Id: Ic19d72e6c012cb06e98c3c970162995e77da4b68
Reviewed-on: http://gerrit.openafs.org/9376
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_osidnlc.c