mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-24 18:20:05 +01:00
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 e156c0ccb5)
This commit is contained in:
parent
3c4cead499
commit
42a74080ff
1 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue