com php-src: check malloc result: win32/codepage.c
| From: | Anatol Belski | Date: | Mon, 08 Aug 2016 08:33:07 +0000 |
| Subject: | com php-src: check malloc result: win32/codepage.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93671@lists.php.net to get a copy of this message | ||
Commit: 33a7ad2365d79a71429c81978190b488cbbc007d
Author: Anatol Belski <ab@php.net> Sat, 6 Aug 2016 22:33:29 +0200
Parents: f706897f330038d17570f5d0e6091e06d90179a6
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=33a7ad2365d79a71429c81978190b488cbbc007d
Log:
check malloc result
Changed paths:
M win32/codepage.c
Diff:
diff --git a/win32/codepage.c b/win32/codepage.c
index d6f42d3..d929130 100644
--- a/win32/codepage.c
+++ b/win32/codepage.c
@@ -369,6 +369,10 @@ PW32CP wchar_t *php_win32_cp_env_any_to_w(const char* env)
} while (NULL != (cur = strchr(prev, '\0')) && cur++ && *cur &&
bin_len + (cur - prev) < 32760);
envw = (wchar_t *) malloc((bin_len + 3) * sizeof(wchar_t));
+ if (!envw) {
+ SET_ERRNO_FROM_WIN32_CODE(ERROR_OUTOFMEMORY);
+ return NULL;
+ }
memmove(envw, ew, bin_len * sizeof(wchar_t));
envw[bin_len] = L'\0';
envw[bin_len + 1] = L'\0';