diff options
author | rishubhjain <rishubhjain47@gmail.com> | 2019-04-08 20:20:12 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-04-22 06:34:49 +0000 |
commit | 119b4e6371f20d20b74ba854d463f827de0609c2 (patch) | |
tree | 2cbaf6181fb6e49fcf90cfcba804fac3b3309a33 /xlators/mgmt | |
parent | b0fce72477d56eeca616ab089756eab4f4b4bf8e (diff) |
GlusterD:Checking for null value to void explicit dereferencing of null pointer
Before calling strtok_r a check for null pointer is necessary to avoid
dereferencing of null pointer
CID:1398617
CID:1274074
Change-Id: I34956c6e04af1faa22d550e6474909ecd36f5d6c
updates: bz#789278
Signed-off-by: rishubhjain <rishubhjain47@gmail.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index e50db060aa1..626c9913d7a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -8458,6 +8458,10 @@ glusterd_set_dump_options(char *dumpoptions_path, char *options, int option_cnt) goto out; } dup_options = gf_strdup(options); + + if (!dup_options) { + goto out; + } gf_msg("glusterd", GF_LOG_INFO, 0, GD_MSG_STATEDUMP_OPTS_RCVD, "Received following statedump options: %s", dup_options); option = strtok_r(dup_options, " ", &tmpptr); @@ -8608,6 +8612,10 @@ glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr) GF_ASSERT(conf); dup_options = gf_strdup(options); + + if (!dup_options) { + goto out; + } option = strtok_r(dup_options, " ", &tmpptr); if (strcmp(option, conf->nfs_svc.name)) { snprintf(msg, sizeof(msg), @@ -8679,6 +8687,9 @@ glusterd_client_statedump(char *volname, char *options, int option_cnt, char *pid = NULL; dup_options = gf_strdup(options); + if (!dup_options) { + goto out; + } option = strtok_r(dup_options, " ", &tmpptr); if (strcmp(option, "client")) { snprintf(msg, sizeof(msg), @@ -8732,6 +8743,9 @@ glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr) GF_ASSERT(conf); dup_options = gf_strdup(options); + if (!dup_options) { + goto out; + } option = strtok_r(dup_options, " ", &tmpptr); if (strcmp(option, conf->quotad_svc.name)) { snprintf(msg, sizeof(msg), |