Kaleb KEITHLEY has uploaded this change for review.

View Change

v4_recovery: off-by-one error, v4_recov_dir is truncated

noticed log entries with invalid path name, e.g.

... fs_rm_revoked_handles :CLIENT ID :EVENT :opendir
/var/lib/nfs/ganesha/v4reco/::ffff:192.168.122.102...

and

... fs_rm_clid_impl :CLIENT ID :EVENT :Failed to remove
client recovery dir (/var/lib/nfs/ganesha/v4reco/::ffff:192...

Inspection of running process shows that v4_recov_dir_len is 27,
but "/var/lib/nfs/ganesha/v4recov" is 28 chars in length. As a
result, at lines 375-376 of fs_recovery.c (in 3.x) one char too
few are copied from the initial parent_path (i.e. v4_recov_dir)
when called from fs_rm_clid().

And at line 892 it kludges around the mistake by copying
v4_recov_dir_len + 1 chars.

Also change to unsigned int for v4_recov_dir_len and v4_old_dir_len
which can never be negative. (Could have used size_t I suppose.)

Change-Id: If25ef835ea459b3e8c796e38fc940890f27b58a7
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
---
M src/SAL/recovery/recovery_fs.c
1 file changed, 5 insertions(+), 5 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/60/515560/1

To view, visit change 515560. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: If25ef835ea459b3e8c796e38fc940890f27b58a7
Gerrit-Change-Number: 515560
Gerrit-PatchSet: 1
Gerrit-Owner: Kaleb KEITHLEY <kaleb@redhat.com>
Gerrit-MessageType: newchange