From: Ilia Alshanetsky Date: Tue, 10 Feb 2009 16:14:35 +0000 (+0000) Subject: MFB:Adjust condition X-Git-Tag: php-5.4.0alpha1~191^2~4304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f18a2ff04cc46acb78234af6b43088f01e7580c1;p=php MFB:Adjust condition --- diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 6319e7b7b4..57ca91cac3 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -636,7 +636,7 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c *end = '\0'; end++; } - if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) > MAXPATHLEN) { + if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); } diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 035ef24cc8..502e996b1a 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -1289,7 +1289,7 @@ not_relative_path: /* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */ *(cwd+3) = '\0'; - if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) > MAXPATHLEN) { + 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); } @@ -1343,7 +1343,7 @@ not_relative_path: if (*ptr == '\0') { goto stream_skip; } - if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) > MAXPATHLEN) { + if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN); }