diff options
author | Jan Dubois <jand@activestate.com> | 2004-04-13 12:49:32 -0700 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-04-15 18:19:57 +0000 |
commit | 9d83db8ad36f0ac54b32b7e4c3feb7e653b07588 (patch) | |
tree | ba81ce5f91562a20a9d2b41a3a3df030c3af517a | |
parent | b08f99954ac05f6d7940d41d47dfcac67b906a1b (diff) | |
download | perl-9d83db8ad36f0ac54b32b7e4c3feb7e653b07588.tar.gz |
Integrate:
[ 22691]
Subject: re: [PATCH] for bug 28525: Buffer overflow issue in the Win32 distribution of 5.8.3
Message-ID: <vm7p70h7au8unrnq4jp85oich7n71ar5ab@4ax.com
[ 22697]
d_getservbyname_r undef up to at least OpenBSD 3.5
Thanks to Campo Weijerman and Gerard Gerritsen off-list
p4raw-link: @22697 on //depot/perl: 2f4c2f3e1aa24195544992a1971d49399f86d7ec
p4raw-link: @22691 on //depot/perl: 1928965c335b0bc2a3df245c2070b6e4b7bfad99
p4raw-id: //depot/maint-5.8/perl@22701
p4raw-integrated: from //depot/perl@22700 'copy in' hints/openbsd.sh
(@22585..) 'merge in' win32/win32.c (@22466..)
-rw-r--r-- | hints/openbsd.sh | 4 | ||||
-rw-r--r-- | win32/win32.c | 13 |
2 files changed, 8 insertions, 9 deletions
diff --git a/hints/openbsd.sh b/hints/openbsd.sh index 3b8acf585e..51a75a9e63 100644 --- a/hints/openbsd.sh +++ b/hints/openbsd.sh @@ -118,8 +118,8 @@ $define|true|[yY]*) ;; esac case "$osvers" in - [012].*|3.[0-3]) - # Broken at least up to OpenBSD 3.2, we'll see about 3.3. + [012].*|3.[0-5]) + # Broken at least up to OpenBSD 3.5, we'll see about 3.6 d_getservbyname_r=$undef ;; esac esac diff --git a/win32/win32.c b/win32/win32.c index eb6a4c6c1c..697be9f43a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3736,7 +3736,10 @@ qualified_path(const char *cmd) /* look in PATH */ pathstr = PerlEnv_getenv("PATH"); - New(0, fullcmd, MAX_PATH+1, char); + + /* worst case: PATH is a single directory; we need additional space + * to append "/", ".exe" and trailing "\0" */ + New(0, fullcmd, (pathstr ? strlen(pathstr) : 0) + cmdlen + 6, char); curfullcmd = fullcmd; while (1) { @@ -3777,17 +3780,13 @@ qualified_path(const char *cmd) if (*pathstr == '"') { /* foo;"baz;etc";bar */ pathstr++; /* skip initial '"' */ while (*pathstr && *pathstr != '"') { - if ((STRLEN)(curfullcmd-fullcmd) < MAX_PATH-cmdlen-5) - *curfullcmd++ = *pathstr; - pathstr++; + *curfullcmd++ = *pathstr++; } if (*pathstr) pathstr++; /* skip trailing '"' */ } else { - if ((STRLEN)(curfullcmd-fullcmd) < MAX_PATH-cmdlen-5) - *curfullcmd++ = *pathstr; - pathstr++; + *curfullcmd++ = *pathstr++; } } if (*pathstr) |