Browse Source

RFC 2231 unwrapping is necessary for all headers...

afl-fuzzing
Roker 3 years ago
parent
commit
cc2863ed5a
2 changed files with 6 additions and 6 deletions
  1. +6
    -5
      src/mime_headers.cc
  2. +0
    -1
      src/mime_headers.hh

+ 6
- 5
src/mime_headers.cc View File

@ -126,14 +126,14 @@ std::string convert(std::string& charset, const std::string& input)
return to_utf8(charset, input);
}
void ContentDisposition::unwrap()
// unwrap multiline header params according to RFC 2231
void unwrap(std::vector<NameValue>& params)
{
std::vector<NameValue> new_params;
std::string ml_name, ml_value; // multiline parameters
std::string charset = "UTF-8";
int old_count = -1;
for(auto& p : dparams)
for(auto& p : params)
{
Rfc2231ParamName pn;
std::string::const_iterator begin = p.name.cbegin();
@ -175,7 +175,7 @@ void ContentDisposition::unwrap()
}
}
dparams.swap(new_params);
params.swap(new_params);
}
@ -258,6 +258,7 @@ ContentType::ContentType(sv header_line)
LOG << "Cannot parse \"" + std::string{cts} + "\" as ContentType.\n";
}
LOG << "<<< CT raw: " << *this << ">>>\n";
unwrap(tparams);
this->sanitize();
LOG << "<<< CT san: " << *this << ">>>\n";
@ -273,7 +274,7 @@ ContentDisposition::ContentDisposition(sv header_line)
LOG << "Cannot parse \"" + std::string{cds} + "\" as ContentDisposition.\n";
}
LOG << "<<< CD raw: " << *this << ">>>\n";
this->unwrap();
unwrap(dparams);
LOG << "<<< CD uw: " << *this << ">>>\n";
}


+ 0
- 1
src/mime_headers.hh View File

@ -28,7 +28,6 @@ namespace pEpMIME
content_disposition_type dispo_type;
std::vector<NameValue> dparams;
void unwrap(); // reverses the wrapping of overlong (andtherefore split) parameter values.
};
struct MimeHeaders : public ContentType, public ContentDisposition


Loading…
Cancel
Save