Skip to content
Snippets Groups Projects
Commit 42a74080 authored by Michel Dänzer's avatar Michel Dänzer Committed by Adam Jackson
Browse files

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's avatarAdam Jackson <ajax@redhat.com>
(cherry picked from commit e156c0cc)
parent 3c4cead4
No related branches found
No related tags found
No related merge requests found
...@@ -1132,19 +1132,20 @@ ComputeLocalClient(ClientPtr client) ...@@ -1132,19 +1132,20 @@ ComputeLocalClient(ClientPtr client)
* is forwarded from another host via SSH * is forwarded from another host via SSH
*/ */
if (cmdname) { if (cmdname) {
char **cmd; char *cmd = strdup(cmdname);
Bool ret; Bool ret;
/* Cut off any colon and whatever comes after it, see /* Cut off any colon and whatever comes after it, see
* https://lists.freedesktop.org/archives/xorg-devel/2015-December/048164.html * https://lists.freedesktop.org/archives/xorg-devel/2015-December/048164.html
*/ */
cmd = xstrtokenize(cmdname, ":"); cmd = strtok(cmd, ":");
#if !defined(WIN32) || defined(__CYGWIN__) #if !defined(WIN32) || defined(__CYGWIN__)
cmd[0] = basename(cmd[0]); ret = strcmp(basename(cmd), "ssh") != 0;
#else
ret = strcmp(cmd, "ssh") != 0;
#endif #endif
ret = strcmp(cmd[0], "ssh") != 0;
free(cmd); free(cmd);
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment