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

index 6319e7b7b4bbd9ef22c5b48203b4e62113717412..57ca91cac3cceab9681f4a08ecd525811bf534f6 100644 (file)
@@ -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);
                }
 
index 035ef24cc8f6e3adf5530bc2af24a20965b0526a..502e996b1af5bc8bf3dd8b4e7ec581857252758a 100644 (file)
@@ -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);
                }