masugata Wed Apr 4 15:23:09 2007 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: Sync with mail function in mb_send_mail function(problem MOPB-33-2007:PHP and MOPB-34-2007:PHP). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.267&r2=1.268&diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.267 php-src/ext/mbstring/mbstring.c:1.268 --- php-src/ext/mbstring/mbstring.c:1.267 Sat Feb 24 16:25:54 2007 +++ php-src/ext/mbstring/mbstring.c Wed Apr 4 15:23:09 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.267 2007/02/24 16:25:54 helly Exp $ */ +/* $Id: mbstring.c,v 1.268 2007/04/04 15:23:09 masugata Exp $ */ /* * PHP 4 Multibyte String module "mbstring" @@ -3321,13 +3321,20 @@ #define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \ if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \ - pos += 3; \ - while (str[pos] == ' ' || str[pos] == '\t') { \ + pos += 2; \ + while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ pos++; \ } \ continue; \ } +#define MAIL_ASCIIZ_CHECK_MBSTRING(str, len) \ + pp = str; \ + ee = pp + len; \ + while ((pp = memchr(pp, '\0', (ee - pp)))) { \ + *pp = ' '; \ + } \ + #define APPEND_ONE_CHAR(ch) do { \ if (token.a > 0) { \ smart_str_appendc(&token, ch); \ @@ -3560,6 +3567,7 @@ HashTable ht_headers; smart_str *s; extern void mbfl_memory_device_unput(mbfl_memory_device *device); + char *pp, *ee; /* initialize */ mbfl_memory_device_init(&device, 0, 0); @@ -3581,6 +3589,17 @@ return; } + /* ASCIIZ check */ + MAIL_ASCIIZ_CHECK_MBSTRING(to, to_len); + MAIL_ASCIIZ_CHECK_MBSTRING(subject, subject_len); + MAIL_ASCIIZ_CHECK_MBSTRING(message, message_len); + if (headers) { + MAIL_ASCIIZ_CHECK_MBSTRING(headers, headers_len); + } + if (extra_cmd) { + MAIL_ASCIIZ_CHECK_MBSTRING(extra_cmd, extra_cmd_len); + } + zend_hash_init(&ht_headers, 0, NULL, (dtor_func_t) my_smart_str_dtor, 0); if (headers != NULL) { @@ -3795,6 +3814,7 @@ } #undef SKIP_LONG_HEADER_SEP_MBSTRING +#undef MAIL_ASCIIZ_CHECK_MBSTRING #undef APPEND_ONE_CHAR #undef SEPARATE_SMART_STR #undef PHP_MBSTR_MAIL_MIME_HEADER1
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php