On Aug 14, 2005, at 6:09 AM, Johannes Schlüter wrote:
+        if (UG(unicode)) {
+            int32_t tmp_len, len;
+            UErrorCode status = U_ZERO_ERROR;
+
+            len = u_strlen((UChar *)retval);
+ zend_convert_from_unicode(ZEND_U_CONVERTER(UG (output_encoding_conv)), &tmp, &tmp_len,
+                                      (UChar *)retval, len, &status);
+
+            retval = malloc(tmp_len + 2);
+            retval[0] = '$';
+            strcpy(&retval[1], tmp);

I would recommend using u_strcpy() for copying Unicode strings around.

+
+        if (UG(unicode)) {
+            char *tmp;
+            int32_t tmp_len, len;
+            UErrorCode status = U_ZERO_ERROR;
+
+            len = u_strlen((UChar *)func->common.function_name);
+ zend_convert_from_unicode(ZEND_U_CONVERTER(UG (output_encoding_conv)), &tmp, &tmp_len, + (UChar *)func- >common.function_name, len, &status);
+
+            retval = strdup(tmp);

Same here, you can't rely on strdup() because it'll stop at the first NULL byte, and Unicode strings have plenty of them.

-Andrei

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to