diff options
author | Jim Meyering <meyering@redhat.com> | 2012-06-20 13:56:36 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-11 19:14:52 -0700 |
commit | 7c88fcd63df71cc1b81caea791235a828c9b419e (patch) | |
tree | a5581dbde976b8fd1d9928c8e77e9498ecb3222a /contrib/fuse-util | |
parent | 4a505c0eb8736d75a677530a7789fc9bc03d4c28 (diff) |
read_conf: don't let a corrupt config file cause invalid line[-1] reference
Change-Id: Ifbc698768d9418a54c1501efa335edd4048cfd41
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3603
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'contrib/fuse-util')
-rw-r--r-- | contrib/fuse-util/fusermount.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/fuse-util/fusermount.c b/contrib/fuse-util/fusermount.c index 4bd5bb61ec4..20a15bed27c 100644 --- a/contrib/fuse-util/fusermount.c +++ b/contrib/fuse-util/fusermount.c @@ -505,13 +505,13 @@ static void read_conf(void) int isnewline = 1; while (fgets(line, sizeof(line), fp) != NULL) { if (isnewline) { - if (line[strlen(line)-1] == '\n') { + if (strlen(line) && line[strlen(line)-1] == '\n') { strip_line(line); parse_line(line, linenum); } else { isnewline = 0; } - } else if(line[strlen(line)-1] == '\n') { + } else if(strlen(line) && line[strlen(line)-1] == '\n') { fprintf(stderr, "%s: reading %s: line %i too long\n", progname, FUSE_CONF, linenum); isnewline = 1; |