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 | 26bb38e68ba1352440793df17eeb3bbdf1fbce7c (patch) | |
tree | 2a846aad5eeb7710283dfa734d0b66f3e6570368 | |
parent | eda798fd7a95e098660c3fa6c356eae5afb04302 (diff) | |
download | php-git-26bb38e68ba1352440793df17eeb3bbdf1fbce7c.tar.gz |
- fix possible NULL deref
-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 b0fd1ae8ab..2335d5e890 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -1874,6 +1874,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)) { @@ -1885,6 +1888,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; } |