- Timestamp:
- 07/11/08 23:20:50 (5 months ago)
- Files:
-
- op/trunk/main.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
op/trunk/main.c
r260 r563 798 798 if (getenv("DISPLAY") != NULL && (cp = FindOpt(cmd, "xauth")) != NULL) { 799 799 struct passwd *currentpw; 800 char tmpxauth[MAXSTRLEN], xauth[MAXSTRLEN], cxauth[MAXSTRLEN], *display;800 char tmpxauth[MAXSTRLEN], *xauth, *cxauth, *display; 801 801 int status; 802 802 uid_t uid; … … 814 814 if ((display = strchr(getenv("DISPLAY"), ':')) == NULL) 815 815 fatal(1, "Could not extract X server from $DISPLAY '%s'", getenv("DISPLAY")); 816 xauth = (char*)malloc(strlen(pw->pw_dir) + strlen("/.Xauthority") + 1); 816 817 strcpy(xauth, pw->pw_dir); 817 818 strcat(xauth, "/.Xauthority"); … … 821 822 /* Now that we know the target user, we can copy the xauth cookies */ 822 823 if (getenv("XAUTHORITY") != NULL) { 823 strcpy(cxauth,getenv("XAUTHORITY"));824 cxauth = strdup(getenv("XAUTHORITY")); 824 825 } else { 826 cxauth = (char*)malloc(strlen(currentpw->pw_dir) + 827 strlen("/.Xauthority") + 1); 825 828 strcpy(cxauth, currentpw->pw_dir); 826 829 strcat(cxauth, "/.Xauthority"); … … 1209 1212 tmp = str_replace(cmd->args[i], 1210 1213 np - cmd->args[i] - 1, cp - np + 1, argv[val]); 1211 cp = tmp + (cp - cmd->args[i]) + 1;1214 cp = tmp + (cp - cmd->args[i]) + (strlen(tmp) - strlen(cmd->args[i]));; 1212 1215 np = cp; 1213 1216 cmd->args[i] = tmp;
