diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
| commit | 038ba12e8724d537040e88ec794354b0c063f0a6 (patch) | |
| tree | a7181b4f4d10e3a154522d4b96fdf42f4597bf2a /TSRM | |
| parent | fd5a0b31640419ca63d1ddeaffd6d3cf2a741814 (diff) | |
| download | php-038ba12e8724d537040e88ec794354b0c063f0a6.tar.gz | |
Imported Upstream version 5.3.6upstream/5.3.6
Diffstat (limited to 'TSRM')
| -rw-r--r-- | TSRM/TSRM.c | 2 | ||||
| -rw-r--r-- | TSRM/TSRM.h | 2 | ||||
| -rw-r--r-- | TSRM/tsrm_nw.c | 4 | ||||
| -rw-r--r-- | TSRM/tsrm_nw.h | 2 | ||||
| -rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 37 | ||||
| -rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 4 | ||||
| -rw-r--r-- | TSRM/tsrm_win32.c | 4 | ||||
| -rw-r--r-- | TSRM/tsrm_win32.h | 4 |
8 files changed, 43 insertions, 16 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 368178ed0..41368a498 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Thread Safe Resource Manager | +----------------------------------------------------------------------+ - | Copyright (c) 1999-2010, Andi Gutmans, Sascha Schumann, Zeev Suraski | + | Copyright (c) 1999-2011, Andi Gutmans, Sascha Schumann, Zeev Suraski | | This source file is subject to the TSRM license, that is bundled | | with this package in the file LICENSE | +----------------------------------------------------------------------+ diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index cd6618f91..d3d6f9b2d 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Thread Safe Resource Manager | +----------------------------------------------------------------------+ - | Copyright (c) 1999-2010, Andi Gutmans, Sascha Schumann, Zeev Suraski | + | Copyright (c) 1999-2011, Andi Gutmans, Sascha Schumann, Zeev Suraski | | This source file is subject to the TSRM license, that is bundled | | with this package in the file LICENSE | +----------------------------------------------------------------------+ diff --git a/TSRM/tsrm_nw.c b/TSRM/tsrm_nw.c index ac566a411..0c2a2fdb8 100644 --- a/TSRM/tsrm_nw.c +++ b/TSRM/tsrm_nw.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_nw.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: tsrm_nw.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> #include <stdio.h> diff --git a/TSRM/tsrm_nw.h b/TSRM/tsrm_nw.h index 489505954..1350e6ebb 100644 --- a/TSRM/tsrm_nw.h +++ b/TSRM/tsrm_nw.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 30f42b1b4..679903621 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c 305070 2010-11-04 01:16:20Z pajoye $ */ +/* $Id: tsrm_virtual_cwd.c 307316 2011-01-10 00:43:08Z pajoye $ */ #include <sys/types.h> #include <sys/stat.h> @@ -509,6 +509,9 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ *length = 1; retval = (char *) malloc(2); + if (retval == NULL) { + return NULL; + } retval[0] = DEFAULT_SLASH; retval[1] = '\0'; return retval; @@ -521,6 +524,9 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */ *length = state->cwd_length+1; retval = (char *) malloc(*length+1); + if (retval == NULL) { + return NULL; + } memcpy(retval, state->cwd, *length); retval[0] = toupper(retval[0]); retval[*length-1] = DEFAULT_SLASH; @@ -648,6 +654,10 @@ static inline void realpath_cache_add(const char *path, int path_len, const char realpath_cache_bucket *bucket = malloc(size); unsigned long n; + if (bucket == NULL) { + return; + } + #ifdef PHP_WIN32 bucket->key = realpath_cache_key(path, path_len TSRMLS_CC); #else @@ -866,6 +876,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); + if (pbuffer == NULL) { + return -1; + } if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) { tsrm_free_alloca(pbuffer, use_heap_large); CloseHandle(hLink); @@ -952,9 +965,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i } if (!isVolume) { - char * tmp = substitutename + substitutename_off; + char * tmp2 = substitutename + substitutename_off; for(bufindex = 0; bufindex < (substitutename_len - substitutename_off); bufindex++) { - *(path + bufindex) = *(tmp + bufindex); + *(path + bufindex) = *(tmp2 + bufindex); } *(path + bufindex) = 0; @@ -1370,6 +1383,10 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* { /* realpath("") returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + retval = NULL; + goto end; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { @@ -1379,6 +1396,10 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* { CWD_STATE_COPY(&new_state, &CWDG(cwd)); } else { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + retval = NULL; + goto end; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } @@ -1394,7 +1415,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* { } CWD_STATE_FREE(&new_state); - +end: return retval; } /* }}} */ @@ -1887,6 +1908,9 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ /* realpath("") returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { @@ -1898,6 +1922,9 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{ new_state.cwd_length = strlen(cwd); } else { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index d1bdd6823..4f7308a21 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h 305070 2010-11-04 01:16:20Z pajoye $ */ +/* $Id: tsrm_virtual_cwd.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 24314c896..6ea8492c8 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_win32.c 294532 2010-02-04 15:34:19Z pajoye $ */ +/* $Id: tsrm_win32.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdio.h> #include <fcntl.h> diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h index 0d6f2ab7c..144d7f32e 100644 --- a/TSRM/tsrm_win32.h +++ b/TSRM/tsrm_win32.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_win32.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: tsrm_win32.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef TSRM_WIN32_H #define TSRM_WIN32_H |
