mirror of
https://github.com/dlang/phobos.git
synced 2025-05-07 03:27:03 +03:00
Merge pull request #1842 from blackwhale/issue-11350
Fix issue 11350 ibphobos2 regex match segfaults when a rare HTTP header is received
This commit is contained in:
commit
84dbc9934d
1 changed files with 42 additions and 34 deletions
|
@ -2062,6 +2062,9 @@ struct HTTP
|
|||
// http headers. On redirected requests there may be several such
|
||||
// status lines. The last one is the one recorded.
|
||||
auto dg = (in char[] header)
|
||||
{
|
||||
import std.utf : UTFException;
|
||||
try
|
||||
{
|
||||
if (header.empty)
|
||||
{
|
||||
|
@ -2105,6 +2108,11 @@ struct HTTP
|
|||
if (!m.empty && callback !is null)
|
||||
callback(fieldName, m.captures[2]);
|
||||
headersIn[fieldName] = m.captures[2].idup;
|
||||
}
|
||||
catch(UTFException e)
|
||||
{
|
||||
//munch it - a header should be all ASCII, any "wrong UTF" is broken header
|
||||
}
|
||||
};
|
||||
|
||||
curl.onReceiveHeader = dg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue