Fix buffer overruns in mb_send_mail
commitb7d310c2d7129932d43dd3e839140633ff675001
authormwilliams@fb.com <mwilliams@fb.com>
Mon, 15 Aug 2016 18:44:22 +0000 (15 11:44 -0700)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Mon, 15 Aug 2016 20:50:21 +0000 (15 13:50 -0700)
treef92bf1093dfb63db293f7b2c92dcfb297d0aa28f
parent40c89b1713bd2525e4a733e11efd1f013a972f69
Fix buffer overruns in mb_send_mail

Summary:
The code assumed that strndup(s, n) allocated at least n+1 bytes, but
it only allocates min(strlen(s), n)+1 bytes.

Differential Revision: D3628971

fbshipit-source-id: 06ba5aae7f1dca20f764d2ca50c789779678c6ae
hphp/runtime/ext/mbstring/ext_mbstring.cpp
hphp/test/slow/ext_mb/mb_sendmail_null.php [new file with mode: 0644]
hphp/test/slow/ext_mb/mb_sendmail_null.php.expectf [new file with mode: 0644]