68a1a6828b
Submitted by Peter Stromberg <home@wilfried.net>. Sound Server for Window Maker.
109 lines
2.9 KiB
Plaintext
109 lines
2.9 KiB
Plaintext
$OpenBSD: patch-wslib_path_c,v 1.1.1.1 2001/01/09 20:59:36 naddy Exp $
|
|
--- wslib/path.c.orig Fri Mar 31 22:10:25 2000
|
|
+++ wslib/path.c Tue Jan 9 20:59:01 2001
|
|
@@ -60,7 +60,7 @@ susergnusteppath(void)
|
|
if (! path)
|
|
SErrorCode = SERR_NOMEMORY;
|
|
else
|
|
- strcpy(path, gspath);
|
|
+ strlcpy(path, gspath, pathlen);
|
|
free(gspath);
|
|
} else {
|
|
pathlen = strlen(sgethomedir()) + 10;
|
|
@@ -68,8 +68,8 @@ susergnusteppath(void)
|
|
if (! path)
|
|
SErrorCode = SERR_NOMEMORY;
|
|
else {
|
|
- strcpy(path, sgethomedir());
|
|
- strcat(path, "/GNUstep");
|
|
+ strlcpy(path, sgethomedir(), pathlen);
|
|
+ strlcat(path, "/GNUstep", pathlen);
|
|
}
|
|
}
|
|
}
|
|
@@ -133,7 +133,7 @@ sexpandpath(char *path)
|
|
path++;
|
|
if (*path=='/' || *path==0) {
|
|
home = sgethomedir();
|
|
- strcat(buffer, home);
|
|
+ strlcat(buffer, home, sizeof(buffer));
|
|
} else {
|
|
int j;
|
|
j = 0;
|
|
@@ -145,7 +145,7 @@ sexpandpath(char *path)
|
|
home = sgetuserhomedir(buffer2);
|
|
if (!home)
|
|
return NULL;
|
|
- strcat(buffer, home);
|
|
+ strlcat(buffer, home, sizeof(buffer));
|
|
}
|
|
}
|
|
|
|
@@ -169,12 +169,12 @@ sexpandpath(char *path)
|
|
tmp = getenv(buffer2);
|
|
if (!tmp) {
|
|
buffer[i] = 0;
|
|
- strcat(buffer, "$(");
|
|
- strcat(buffer, buffer2);
|
|
- strcat(buffer, ")");
|
|
+ strlcat(buffer, "$(", sizeof(buffer));
|
|
+ strlcat(buffer, buffer2, sizeof(buffer));
|
|
+ strlcat(buffer, ")", sizeof(buffer));
|
|
i += strlen(buffer2)+3;
|
|
} else {
|
|
- strcat(buffer, tmp);
|
|
+ strlcat(buffer, tmp, sizeof(buffer));
|
|
i += strlen(tmp);
|
|
}
|
|
} else {
|
|
@@ -184,11 +184,11 @@ sexpandpath(char *path)
|
|
}
|
|
tmp = getenv(buffer2);
|
|
if (!tmp) {
|
|
- strcat(buffer, "$");
|
|
- strcat(buffer, buffer2);
|
|
+ strlcat(buffer, "$", sizeof(buffer));
|
|
+ strlcat(buffer, buffer2, sizeof(buffer));
|
|
i += strlen(buffer2)+1;
|
|
} else {
|
|
- strcat(buffer, tmp);
|
|
+ strlcat(buffer, tmp, sizeof(buffer));
|
|
i += strlen(tmp);
|
|
}
|
|
}
|
|
@@ -209,7 +209,6 @@ getLocalConfigurationPath(void)
|
|
char *gspath;
|
|
|
|
gspath = susergnusteppath();
|
|
- path = malloc(strlen(gspath) + strlen(DEFAULTS_DIR) + strlen(WMSOUND_DOMAIN)+4);
|
|
path = malloc(MAXPATHLEN * sizeof(char));
|
|
if (! path) {
|
|
SErrorCode = SERR_NOMEMORY;
|
|
@@ -218,10 +217,10 @@ getLocalConfigurationPath(void)
|
|
|
|
return NULL;
|
|
}
|
|
- strcpy(path, gspath);
|
|
- strcat(path, DEFAULTS_DIR);
|
|
- strcat(path, "/");
|
|
- strcat(path, WMSOUND_DOMAIN);
|
|
+ strlcpy(path, gspath, MAXPATHLEN);
|
|
+ strlcat(path, DEFAULTS_DIR, MAXPATHLEN);
|
|
+ strlcat(path, "/", MAXPATHLEN);
|
|
+ strlcat(path, WMSOUND_DOMAIN, MAXPATHLEN);
|
|
|
|
return path;
|
|
}
|
|
@@ -257,9 +256,9 @@ getGlobalConfigurationPath(void)
|
|
char *tmpbuffer = strchr(buffer, '\n');
|
|
tmpbuffer[0] = '/';
|
|
} else
|
|
- strcat(buffer, "/");
|
|
+ strlcat(buffer, "/", MAXPATHLEN);
|
|
|
|
- strcat(buffer, WMSOUND_DOMAIN);
|
|
+ strlcat(buffer, WMSOUND_DOMAIN, MAXPATHLEN);
|
|
result = strdup(buffer);
|
|
free(buffer);
|
|
|