summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-01-10 00:30:07 +0000
committerPierre Joye <pajoye@php.net>2011-01-10 00:30:07 +0000
commit8640b61c68fd61dfe999f178c61ff722f000a441 (patch)
treec2d5e6d597f763da8c3284cf1dda9bf33199f439 /TSRM
parenteddd9b751088572f32f82f6dda7c3dd02144ca02 (diff)
downloadphp-git-8640b61c68fd61dfe999f178c61ff722f000a441.tar.gz
- fix possible NULL deref
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c6
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;
}