Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- fix possible NULL deref

  • Loading branch information...
commit 8640b61c68fd61dfe999f178c61ff722f000a441 1 parent eddd9b7
pierrejoye pierrejoye authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 TSRM/tsrm_virtual_cwd.c
6 TSRM/tsrm_virtual_cwd.c
View
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.