diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2009-02-10 14:18:46 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2009-02-10 14:18:46 +0000 |
commit | 986a933c821dd7360310457cfa4b7dfb1f000179 (patch) | |
tree | 8348cc5ec5d2b4fb1397eb034e453659455c29af /main/streams/plain_wrapper.c | |
parent | 037400bbeb391c4126b52728ffe46d25cf0c9ef7 (diff) | |
download | php-git-986a933c821dd7360310457cfa4b7dfb1f000179.tar.gz |
MFB: 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.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 8b554fdf5b..8448288905 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -1328,7 +1328,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); @@ -1389,7 +1391,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; |