summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-03-30 18:23:04 +0900
committerAdam Jackson <ajax@redhat.com>2016-07-19 13:25:35 -0400
commit42a74080ffe93502904ede7555652f01ab11d12d (patch)
tree1b60757a96abbedf04167c597c586b31f1e01af4
parent3c4cead499f10dabac20ab87728746ec41dae799 (diff)
os: Use strtok instead of xstrtokenize in ComputeLocalClient
Fixes leaking the memory pointed to by the members of the array returned by xstrtokenize. Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit e156c0ccb530897d3a428255bd5585f7ea7b9b41)
-rw-r--r--os/access.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/os/access.c b/os/access.c
index 08c4fd0d9..dac6f49a6 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1132,19 +1132,20 @@ ComputeLocalClient(ClientPtr client)
* is forwarded from another host via SSH
*/
if (cmdname) {
- char **cmd;
+ char *cmd = strdup(cmdname);
Bool ret;
/* Cut off any colon and whatever comes after it, see
* https://lists.freedesktop.org/archives/xorg-devel/2015-December/048164.html
*/
- cmd = xstrtokenize(cmdname, ":");
+ cmd = strtok(cmd, ":");
#if !defined(WIN32) || defined(__CYGWIN__)
- cmd[0] = basename(cmd[0]);
+ ret = strcmp(basename(cmd), "ssh") != 0;
+#else
+ ret = strcmp(cmd, "ssh") != 0;
#endif
- ret = strcmp(cmd[0], "ssh") != 0;
free(cmd);
return ret;