com php-src: Fix allocation: ext/standard/basic_functions.c
| From: | Anatol Belski | Date: | Mon, 27 Nov 2017 20:18:08 +0000 |
| Subject: | com php-src: Fix allocation: ext/standard/basic_functions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100390@lists.php.net to get a copy of this message | ||
Commit: 06202f0feba76a6248dbece73fc28c678b4cf57a
Author: Anatol Belski <ab@php.net> Mon, 27 Nov 2017 21:18:08 +0100
Parents: 2868ff84df1cd6ec2be1e5d60355fe30d6a98923
Branches: PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=06202f0feba76a6248dbece73fc28c678b4cf57a
Log:
Fix allocation
Changed paths:
M ext/standard/basic_functions.c
Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 76d1941..5ab301a 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4098,7 +4098,7 @@ PHP_FUNCTION(getenv)
RETURN_EMPTY_STRING();
}
- valw = emalloc(size);
+ valw = emalloc((size + 1) * sizeof(wchar_t));
size = GetEnvironmentVariableW(keyw, valw, size);
if (size == 0) {
/* has been removed between the two calls */