]> granicus.if.org Git - php/commitdiff
Adjust condition
authorIlia Alshanetsky <iliaa@php.net>
Tue, 10 Feb 2009 16:14:18 +0000 (16:14 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 10 Feb 2009 16:14:18 +0000 (16:14 +0000)
main/fopen_wrappers.c
main/streams/plain_wrapper.c

index 2ffce25b9ef7b79d0a26ed53d1bb9bcc84611b46..5c941b2ee2baad33817263ccba9878f3fed4a9b4 100644 (file)
@@ -706,7 +706,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);
                }
                if (PG(safe_mode)) {
index 2b46d506d100a88a7f9f8759b0dcbe26b55d3153..8a7d3c2fc9f858ba27b100193867e95abde1ed1a 100644 (file)
@@ -1328,7 +1328,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);
                }
                
@@ -1391,7 +1391,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);
                }