diff options
author | Jim Meyering <meyering@redhat.com> | 2012-06-20 11:33:10 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-11 19:14:23 -0700 |
commit | 4a505c0eb8736d75a677530a7789fc9bc03d4c28 (patch) | |
tree | 732e7bec84471167ecbe601aead03d14c7faeef6 /xlators/features/marker | |
parent | 57e72677ac1123b583be8daec2287efac87362df (diff) |
gsyncd: don't let a bogus config file make us read/write buf[-1]
Change-Id: Ic55c28c572c1878f8a223ae2fd25d301a7ef0c12
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3596
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/marker')
-rw-r--r-- | xlators/features/marker/utils/src/gsyncd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/features/marker/utils/src/gsyncd.c b/xlators/features/marker/utils/src/gsyncd.c index 7da2c983c..487eea1e5 100644 --- a/xlators/features/marker/utils/src/gsyncd.c +++ b/xlators/features/marker/utils/src/gsyncd.c @@ -107,6 +107,7 @@ invoke_gsyncd (int argc, char **argv) char *nargv[argc + 4]; if (restricted) { + size_t len; /* in restricted mode we forcibly use the system-wide config */ runinit (&runner); runner_add_args (&runner, SBIN_DIR"/gluster", @@ -116,9 +117,10 @@ invoke_gsyncd (int argc, char **argv) if (runner_start (&runner) == 0 && fgets (config_file, PATH_MAX, runner_chio (&runner, STDOUT_FILENO)) != NULL && - config_file[strlen (config_file) - 1] == '\n' && + (len = strlen (config_file)) && + config_file[len - 1] == '\n' && runner_end (&runner) == 0) - gluster_workdir_len = strlen (config_file) - 1; + gluster_workdir_len = len - 1; if (gluster_workdir_len) { if (gluster_workdir_len + 1 + strlen (GSYNCD_CONF) + 1 > |