summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2013-09-18 19:49:36 -0700
committerChristopher Jones <sixd@php.net>2013-09-18 19:49:36 -0700
commitc2b8a726737e0046eb72be535fdb4fb8dca57f3b (patch)
tree346f8b0ce00a53ab2f52c132d2e081f38efa6a56 /main
parente06a712c900d05895dd9d03c9ff5caa708fc30e7 (diff)
parent94e4c4df86719dbdf265b9d7ccfd1db8cfd32fdf (diff)
downloadphp-git-c2b8a726737e0046eb72be535fdb4fb8dca57f3b.tar.gz
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into PHP-5.5
# By David Soria Parra (6) and others # Via David Soria Parra (5) and Michael Wallner (1) * 'PHP-5.5' of https://git.php.net/repository/php-src: Revert "EmptyIterator now implements Countable; fixes bug 60577" RFC 6598 reserved ip range starts at 100.64.0.0 fix a very rare case of use of uninitialized value combined with a memleak NEWS for added reserved ip addresses according to RFC 6598 Add RFC 6598 IPs to reserved addresses NEWS for #60577 NEWS for bug #64441 Fix bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names) EmptyIterator now implements Countable; fixes bug 60577 News for bugfix #64157 Bug 64157 Changed error message to make sense
Diffstat (limited to 'main')
-rw-r--r--main/fopen_wrappers.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 6f11cf3f32..9b8645a061 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -775,7 +775,12 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co
* we cannot cannot getcwd() and the requested,
* relatively referenced file is accessible */
copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath);
- real_path = estrndup(filepath, copy_len);
+ if (real_path) {
+ memcpy(real_path, filepath, copy_len);
+ real_path[copy_len] = '\0';
+ } else {
+ real_path = estrndup(filepath, copy_len);
+ }
close(fdtest);
return real_path;
} else {