diff options
author | Michael Adam <obnox@samba.org> | 2015-03-31 02:36:30 +0200 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-04-01 10:07:00 -0700 |
commit | dc26a253f5f393745bd435721e31d6e2e598eed1 (patch) | |
tree | eb4454648fbae2ffb6e8a9f0439303313beb547f | |
parent | 4b18fba4064992e00cd5ebe1831afc79beab17b2 (diff) |
features/changelog: fix possible memory illegal access (2 of 2, coverity)
Coverity CID 1288822 (#2 of 2)
strncpy executed with a limit equal to the target array
size potentially leaves the target string not null terminated.
Make sure the copied string is a valid 0 terminated string.
Change-Id: If283dd6f716912f65729edf6ea26a4331a697151
BUG: 789278
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-on: http://review.gluster.org/10059
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog-journal-handler.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c index 6ee6f9f074f..3cb0eef7ba6 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c +++ b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c @@ -876,7 +876,8 @@ gf_changelog_init_history (xlator_t *this, goto dealloc_hist; } - (void) strncpy (jnl->hist_jnl->jnl_brickpath, brick_path, PATH_MAX); + (void) strncpy (jnl->hist_jnl->jnl_brickpath, brick_path, PATH_MAX-1); + jnl->hist_jnl->jnl_brickpath[PATH_MAX-1] = 0; for (i = 0; i < 256; i++) { jnl->hist_jnl->rfc3986[i] = |