summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2003-12-07 12:59:54 +0000
committerStanislav Malyshev <stas@php.net>2003-12-07 12:59:54 +0000
commitfacea7fb70457b42e515a5b19e44889e16923ebd (patch)
treed2f965bf57a68c0c8cddf2d3fdc254f227859a04 /sapi
parenta98892900b03f0849d56599853ca74318a09865d (diff)
downloadphp-git-facea7fb70457b42e515a5b19e44889e16923ebd.tar.gz
fix potential buffer overrun
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/libfcgi/os_unix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sapi/cgi/libfcgi/os_unix.c b/sapi/cgi/libfcgi/os_unix.c
index 6d4e103272..bbaf112621 100644
--- a/sapi/cgi/libfcgi/os_unix.c
+++ b/sapi/cgi/libfcgi/os_unix.c
@@ -103,6 +103,11 @@ static int volatile maxFd = -1;
static int shutdownPending = FALSE;
static int shutdownNow = FALSE;
+#ifndef HAVE_STRLCPY
+#define strlcpy php_strlcpy
+#endif
+size_t strlcpy(char *dst, const char *src, size_t siz);
+
void OS_ShutdownPending()
{
shutdownPending = TRUE;
@@ -293,7 +298,7 @@ int OS_CreateLocalIpcFd(const char *bindPath, int backlog, int bCreateMutex)
short port = 0;
char host[MAXPATHLEN];
- strcpy(host, bindPath);
+ strlcpy(host, bindPath, MAXPATHLEN-1);
if((tp = strchr(host, ':')) != 0) {
*tp++ = 0;
if((port = atoi(tp)) == 0) {
@@ -396,7 +401,7 @@ int OS_FcgiConnect(char *bindPath)
short port = 0;
int tcp = FALSE;
- strcpy(host, bindPath);
+ strlcpy(host, bindPath, MAXPATHLEN-1);
if((tp = strchr(host, ':')) != 0) {
*tp++ = 0;
if((port = atoi(tp)) == 0) {