moriyoshi Sun Jul 6 17:30:23 2003 EDT
Modified files:
/php-src/ext/iconv iconv.c
Log:
Fixed segfault due to reference to the already free'd block :)
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.91 php-src/ext/iconv/iconv.c:1.92
--- php-src/ext/iconv/iconv.c:1.91 Sun Jul 6 17:19:08 2003
+++ php-src/ext/iconv/iconv.c Sun Jul 6 17:30:23 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.91 2003/07/06 21:19:08 moriyoshi Exp $ */
+/* $Id: iconv.c,v 1.92 2003/07/06 21:30:23 moriyoshi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1600,7 +1600,7 @@
char *in_charset;
char *out_charset;
long line_len = 76;
- char *lfchars = "\r\n";
+ zval lfchars;
php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
@@ -1664,23 +1664,18 @@
}
if (zend_hash_find(Z_ARRVAL_P(pref), "line-break-chars",
sizeof("line-break-chars"), (void **)&ppval) == SUCCESS) {
- pval = *ppval;
- if (Z_TYPE_P(pval) != IS_STRING) {
- val = *pval;
- zval_copy_ctor(&val);
- convert_to_string(&val);
- pval = &val;
- }
+ lfchars = **ppval;
+ zval_copy_ctor(&lfchars);
- lfchars = Z_STRVAL_P(pval);
-
- if (pval == &val) {
- zval_dtor(&val);
+ if (Z_TYPE(lfchars) != IS_STRING) {
+ convert_to_string(&lfchars);
}
+ } else {
+ ZVAL_STRING(&lfchars, "\r\n", 1);
}
err = _php_iconv_mime_encode(&retval, field_name, field_name_len,
- field_value, field_value_len, line_len, lfchars, scheme_id,
+ field_value, field_value_len, line_len, Z_STRVAL(lfchars), scheme_id,
out_charset, in_charset);
_php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
@@ -1694,6 +1689,8 @@
smart_str_free(&retval);
RETVAL_FALSE;
}
+
+ zval_dtor(&lfchars);
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php