diff options
author | Anoop C S <achiraya@redhat.com> | 2015-03-24 14:34:52 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-04 10:58:15 -0700 |
commit | d2ada381fe332b6151d12d3ef1d1e47f9f7c77f7 (patch) | |
tree | 7cf5260fcb9f842512264b0174a33f17c1c7a78b /xlators/features/trash/src | |
parent | 5e7cc20d3cc37a03f594237bdf85c67397c3ceac (diff) |
features/trash: More coverity fixes
The following CIDs are being addressed:
1288792
1288794
Change-Id: Ic2cdaf43f05488e04616ceb801b47a47c6a93656
BUG: 789278
Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-on: http://review.gluster.org/10082
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/trash/src')
-rw-r--r-- | xlators/features/trash/src/trash.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index 521532ec1f6..07492e3addf 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -687,7 +687,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (count == 0) count = 1; i++; - if ((i > loop_count) || (count > PATH_MAX)) + if (i > loop_count) break; tmp_dirname = strchr (tmp_str + count + 1, '/'); } @@ -1026,6 +1026,13 @@ trash_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflags, * name collisions inside trash */ append_time_stamp (local->newpath); + if (strlen (local->newpath) > PATH_MAX) { + STACK_WIND (frame, trash_common_unwind_cbk, + FIRST_CHILD(this), + FIRST_CHILD(this)->fops->unlink, loc, 0, + xdata); + goto out; + } LOCK_INIT (&frame->lock); @@ -1397,7 +1404,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (count == 0) count = 1; i++; - if ((i > loop_count) || (count > PATH_MAX)) + if (i > loop_count) break; tmp_dirname = strchr (tmp_str + count + 1, '/'); } @@ -1522,6 +1529,13 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* append timestamp to file name so that we can avoid name collisions inside trash */ append_time_stamp (local->newpath); + if (strlen (local->newpath) > PATH_MAX) { + STACK_WIND (frame, trash_common_unwind_buf_cbk, + FIRST_CHILD(this), + FIRST_CHILD(this)->fops->truncate, + &local->loc, local->fop_offset, xdata); + goto out; + } strcpy (loc_newname, local->loc.name); append_time_stamp (loc_newname); |