summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-05 02:51:09 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-05 02:53:59 -0700
commit1747120043cc5b5d201b7efd06b75ef08b032922 (patch)
tree283f475a35bfc5643eace94ed91ca9ce2f3d9a7b
parentbe37f339a9ed90b9b5e44aeb396ca73347078027 (diff)
XQuartz: Fix a strcpy/strcmp typo
(cherry picked from commit 701c24da3ef76a05ccb2d7e84ccfa1b7c5d38e15)
-rw-r--r--hw/xquartz/mach-startup/bundle-main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index be5d24ba3..7531a0ead 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -327,7 +327,7 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
char **_envp = alloca((envpCnt + 1) * sizeof(char *));
size_t i;
- /* If we didn't get handed a launchd DISPLAY socket, we shoul
+ /* If we didn't get handed a launchd DISPLAY socket, we should
* unset DISPLAY or we can run into problems with pbproxy
*/
if(!launchd_socket_handed_off)
@@ -484,14 +484,15 @@ static void setup_env() {
}
if(s && *s) {
- temp = (char *)malloc(sizeof(char) * (strlen(pds) + 3));
+ size_t pds_len = strlen(pds);
+ temp = (char *)malloc(sizeof(char) * pds_len);
if(!temp) {
fprintf(stderr, "Memory allocation error creating space for socket name test.\n");
}
- strcpy(temp, pds);
- strcat(temp, ":0");
+ strlcpy(temp, pds, pds_len - 3);
+ strlcat(temp, ":0", pds_len);
- if(strcpy(temp, s) != 0) {
+ if(strcmp(temp, s) != 0) {
/* If we don't have a match, unset it. */
unsetenv("DISPLAY");
}