Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
220375b4
Commit
220375b4
authored
Feb 28, 2018
by
artix
Browse files
Fixed memory write error in clusterManagerGetConfigSignature
parent
99da9c95
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
220375b4
...
@@ -2295,7 +2295,7 @@ static void clusterManagerShowNodes(void) {
...
@@ -2295,7 +2295,7 @@ static void clusterManagerShowNodes(void) {
while ((ln = listNext(&li)) != NULL) {
while ((ln = listNext(&li)) != NULL) {
clusterManagerNode *node = ln->value;
clusterManagerNode *node = ln->value;
sds info = clusterManagerNodeInfo(node, 0);
sds info = clusterManagerNodeInfo(node, 0);
printf("%s\n", info);
printf("%s\n",
(char *)
info);
sdsfree(info);
sdsfree(info);
}
}
}
}
...
@@ -2916,8 +2916,8 @@ static sds clusterManagerGetConfigSignature(clusterManagerNode *node) {
...
@@ -2916,8 +2916,8 @@ static sds clusterManagerGetConfigSignature(clusterManagerNode *node) {
line = p + 1;
line = p + 1;
if (i == 0) {
if (i == 0) {
nodename = token;
nodename = token;
tot_size = p - token;
tot_size =
(
p - token
)
;
name_len = tot_size
;
name_len = tot_size
++; // Make room for ':' in tot_size
} else if (i == 8) break;
} else if (i == 8) break;
i++;
i++;
}
}
...
@@ -2951,6 +2951,7 @@ static sds clusterManagerGetConfigSignature(clusterManagerNode *node) {
...
@@ -2951,6 +2951,7 @@ static sds clusterManagerGetConfigSignature(clusterManagerNode *node) {
node_count++;
node_count++;
node_configs =
node_configs =
zrealloc(node_configs, (node_count * sizeof(char *)));
zrealloc(node_configs, (node_count * sizeof(char *)));
/* Make room for '|' separators. */
tot_size += (sizeof(char) * (c - 1));
tot_size += (sizeof(char) * (c - 1));
char *cfg = zmalloc((sizeof(char) * tot_size) + 1);
char *cfg = zmalloc((sizeof(char) * tot_size) + 1);
memcpy(cfg, nodename, name_len);
memcpy(cfg, nodename, name_len);
...
@@ -3760,7 +3761,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
...
@@ -3760,7 +3761,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
opts, &err);
opts, &err);
if (!result) {
if (!result) {
if (err != NULL) {
if (err != NULL) {
clusterManagerLogErr("\n%s\n", err);
//
clusterManagerLogErr("\n%s\n", err);
zfree(err);
zfree(err);
}
}
goto cleanup;
goto cleanup;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment