Parser OptionsMax Header Length Property
Get or set the maximum length of a header that the parser should accept.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The maximum header length, in bytes.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public int MaxHeaderLength { get; set; }Property Value
Int32The maximum header length, in bytes.
Remarks
This option exists in order to limit the amount of memory that the parser will allocate for any single header. Without a limit, a maliciously crafted message containing a single enormous (e.g. folded) header could force the parser to buffer the entire header in memory.
The length is measured in bytes of raw header data and includes the field name, the colon, the raw value (including any folding), and the terminating newline sequence.
When a header exceeds this limit, the parser will throw a FormatException.
The default value is 16384 (16 KB).
Exceptions
| ArgumentOutOfRangeException | value is less than 1. |