diff options
author | Pierre Joye <pajoye@php.net> | 2011-01-10 00:30:07 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2011-01-10 00:30:07 +0000 |
commit | 8640b61c68fd61dfe999f178c61ff722f000a441 (patch) | |
tree | c2d5e6d597f763da8c3284cf1dda9bf33199f439 /TSRM | |
parent | eddd9b751088572f32f82f6dda7c3dd02144ca02 (diff) | |
download | php-git-8640b61c68fd61dfe999f178c61ff722f000a441.tar.gz |
- fix possible NULL deref
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 8cf7226384..8d8eb36db5 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -1887,6 +1887,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 +1901,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; } |