svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
| From: | Pierre Joye | Date: | Mon, 10 Jan 2011 00:30:07 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-64317@lists.php.net to get a copy of this message | ||
pajoye Mon, 10 Jan 2011 00:30:07 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=307315
Log:
- fix possible NULL deref
Changed paths:
U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:06:29 UTC (rev 307314)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:30:07 UTC (rev 307315)
@@ -1887,6 +1887,9 @@
/* 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 @@
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;
}
Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:06:29 UTC (rev 307314)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:30:07 UTC (rev 307315)
@@ -1874,6 +1874,9 @@
/* 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 @@
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;
}