summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-02-10 14:18:29 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-02-10 14:18:29 +0000
commit0cb1a198517905b52c280053faa9637d79100f4e (patch)
treeaf5e850ee70558f479952c1fa52f63e6b1250233 /main/streams/plain_wrapper.c
parent54f742e30dc262ab5eb885b261716402cb756e3c (diff)
downloadphp-git-0cb1a198517905b52c280053faa9637d79100f4e.tar.gz
Added path truncation E_NOTICE to let people now when path resolving caused
the file path to be truncated.
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 0b0a3000b2..b2efa93f75 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -1324,7 +1324,9 @@ not_relative_path:
/* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */
*(cwd+3) = '\0';
- snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename);
+ if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) > MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN);
+ }
free(cwd);
@@ -1385,7 +1387,9 @@ not_relative_path:
if (*ptr == '\0') {
goto stream_skip;
}
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
+ if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) > MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %file", ptr, filename, MAXPATHLEN);
+ }
if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0 TSRMLS_CC)) {
goto stream_skip;