cli: fixed cli crash during volume set operation
PROBLEM: The cli crashes in the following case: gluster> volume set v3 auth.allow "write-behind" CAUSE: The second strncat operation in the last iteration of the for loop, in cli_to_glusterd writes off the end of the space malloc'd for "cmd", leading to memory corruption. FIX: Made the last strncat operation conditional so that in the last iteration, strncat is avoided. Change-Id: I8f836c684f33a6328e384ab8e677b8e32bcb4e55 BUG: 862526 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/4025 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
557602e763
commit
8d92fabe6a
@ -6005,7 +6005,8 @@ cli_to_glusterd (gf_cli_req *req, call_frame_t *frame,
|
||||
|
||||
for (i = 0; words[i]; i++) {
|
||||
strncat (cmd, words[i], strlen (words[i]));
|
||||
strncat (cmd, " ", strlen (" "));
|
||||
if (words[i+1] != NULL)
|
||||
strncat (cmd, " ", strlen (" "));
|
||||
}
|
||||
|
||||
cmd [len - 1] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user