1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 10:03:18 +02:00

- Last one for tonight. Make sure that we don't check uninitialized

- memory
This commit is contained in:
Andi Gutmans
2000-06-16 01:23:03 +00:00
parent b73a6f883d
commit f8ecf34bf1

View File

@@ -325,26 +325,31 @@ PHPAPI FILE *php_fopen_primary_script(void)
}
} else
#endif
#ifdef PHP_WIN32
if (PG(doc_root) && path_info && (IS_SLASH(*PG(doc_root))
/* Check for absolute path. This should also use virtual cwd macros */
|| (PG(doc_root)[1] == ':' && IS_SLASH(PG(doc_root)[2]))) {
#else
if (PG(doc_root) && path_info && IS_SLASH(*PG(doc_root))) {
#endif
if (PG(doc_root) && path_info) {
length = strlen(PG(doc_root));
filename = emalloc(length + strlen(path_info) + 2);
if (filename) {
memcpy(filename, PG(doc_root), length);
if (!IS_SLASH(filename[length - 1])) /* length is never 0 */
filename[length++] = DEFAULT_SLASH;
if (IS_SLASH(path_info[0]))
length--;
strcpy(filename + length, path_info);
STR_FREE(SG(request_info).path_translated);
SG(request_info).path_translated = filename;
#ifdef PHP_WIN32
/* Check for absolute path. This should really use virtual cwd macros */
if (IS_SLASH(*PG(doc_root) || (length >= 3 && PG(doc_root)[1] == ':' && IS_SLASH(PG(doc_root)[2]))) {
#else
if (IS_SLASH(*PG(doc_root))) {
#endif
length = strlen(PG(doc_root));
filename = emalloc(length + strlen(path_info) + 2);
if (filename) {
memcpy(filename, PG(doc_root), length);
if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */
filename[length++] = DEFAULT_SLASH;
}
if (IS_SLASH(path_info[0])) {
length--;
}
strcpy(filename + length, path_info);
STR_FREE(SG(request_info).path_translated);
SG(request_info).path_translated = filename;
}
}
} /* if doc_root && path_info */
} /* if doc_root && path_info */
if (!filename) {
/* we have to free SG(request_info).path_translated here because
php_destroy_request_info assumes that it will get