]> granicus.if.org Git - php/commitdiff
bail out if zend_unicode_to_string() fails
authorAntony Dovgal <tony2001@php.net>
Thu, 21 Dec 2006 00:25:58 +0000 (00:25 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 21 Dec 2006 00:25:58 +0000 (00:25 +0000)
ext/standard/datetime.c

index 9f2466636f24e7e8cf7ecb165aba69caac999b7b..fd07b9eda318d73728fc7e2a5bc5559bd510d2ea 100644 (file)
@@ -106,11 +106,16 @@ PHP_FUNCTION(strptime)
                char *temp;
                int temp_len;
 
-               zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp, &temp_len, ts.u, ts_length TSRMLS_CC);
+               if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp, &temp_len, ts.u, ts_length TSRMLS_CC) == FAILURE) {
+                       RETURN_FALSE;
+               }
                ts.s = temp;
                ts_length = temp_len;
 
-               zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp, &temp_len, format.u, format_length TSRMLS_CC);
+               if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp, &temp_len, format.u, format_length TSRMLS_CC) == FAILURE) {
+                       efree(ts.s);
+                       RETURN_FALSE;
+               }
                format.s = temp;
                format_length = temp_len;
        }