1
Origin: http://svn.php.net/viewvc?view=revision&revision=319457
2
and http://svn.php.net/viewvc?view=revision&revision=319442
3
and http://svn.php.net/viewvc?view=revision&revision=314527
4
Subject: fixes for bug #55748 (fail to check zend_strndup for failures)
7
Sync to 5.3 and check additional cases for #55748
13
Zend/zend_builtin_functions.c | 3 +++
14
ext/com_dotnet/com_typeinfo.c | 4 ++++
15
ext/oci8/oci8.c | 17 ++++++++++++++++-
16
ext/standard/syslog.c | 3 +++
17
4 files changed, 26 insertions(+), 1 deletion(-)
19
Index: b/ext/oci8/oci8.c
20
===================================================================
23
@@ -2003,7 +2003,14 @@ php_oci_connection *php_oci_do_connect_e
24
connection->is_persistent = 0;
26
connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
27
+ if (connection == NULL) {
30
connection->hash_key = zend_strndup(hashed_details.c, hashed_details.len);
31
+ if (connection->hash_key == NULL) {
35
connection->is_persistent = 1;
38
@@ -2617,12 +2624,20 @@ static php_oci_spool *php_oci_create_spo
39
ub4 poolmode = OCI_DEFAULT; /* Mode to be passed to OCISessionPoolCreate */
40
OCIAuthInfo *spoolAuth = NULL;
42
- /*Allocate sessionpool out of persistent memory */
43
+ /* Allocate sessionpool out of persistent memory */
44
session_pool = (php_oci_spool *) calloc(1, sizeof(php_oci_spool));
45
+ if (session_pool == NULL) {
47
+ goto exit_create_spool;
50
/* Populate key if passed */
52
session_pool->spool_hash_key = zend_strndup(hash_key, hash_key_len);
53
+ if (session_pool->spool_hash_key == NULL) {
55
+ goto exit_create_spool;
59
/* Create the session pool's env */
60
Index: b/ext/standard/syslog.c
61
===================================================================
62
--- a/ext/standard/syslog.c
63
+++ b/ext/standard/syslog.c
64
@@ -236,6 +236,9 @@ PHP_FUNCTION(openlog)
65
free(BG(syslog_device));
67
BG(syslog_device) = zend_strndup(ident, ident_len);
68
+ if(BG(syslog_device) == NULL) {
71
openlog(BG(syslog_device), option, facility);
74
Index: b/ext/com_dotnet/com_typeinfo.c
75
===================================================================
76
--- a/ext/com_dotnet/com_typeinfo.c
77
+++ b/ext/com_dotnet/com_typeinfo.c
78
@@ -187,6 +187,10 @@ PHPAPI int php_com_import_typelib(ITypeL
79
const_name = php_com_olestring_to_string(bstr_ids, &c.name_len, codepage TSRMLS_CC);
80
c.name = zend_strndup(const_name, c.name_len);
82
+ if(c.name == NULL) {
83
+ ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
86
c.name_len++; /* include NUL */
87
SysFreeString(bstr_ids);
89
Index: b/Zend/zend_builtin_functions.c
90
===================================================================
91
--- a/Zend/zend_builtin_functions.c
92
+++ b/Zend/zend_builtin_functions.c
93
@@ -683,6 +683,9 @@ repeat:
95
c.flags = case_sensitive; /* non persistent */
96
c.name = zend_strndup(name, name_len);
97
+ if(c.name == NULL) {
100
c.name_len = name_len+1;
101
c.module_number = PHP_USER_CONSTANT;
102
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {