TnefOptionsMaxTotalDataBytes Property

Get or set the maximum number of bytes of value data that will be read into memory.

Definition

Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public long MaxTotalDataBytes { get; set; }

Property Value

Int64
The maximum number of bytes. The default is DefaultMaxTotalDataBytes.

Remarks

Gets or sets the maximum total number of bytes of attribute and property values that will be read into memory for a single TNEF stream, including the values of any embedded messages. This protects against maliciously formed streams that contain a large number of values that are each smaller than MaxPropertyValueLength.

Once the limit has been reached, a DataSizeLimitExceeded issue is reported for each additional string, binary or object value that would be read into memory and the value is skipped as described for MaxPropertyValueLength. Fixed-width values are still read.

The limit does not apply to values that are read using OpenValueStream, OpenValueStream or OpenEmbeddedMessage, but it does apply to the message bodies and attachment content that are buffered by TnefMessage.

The default limit is suitable for messages that are subject to the 25-35 MB message size limits that are common for SMTP servers. Applications that accept larger messages should increase it.

Exceptions

ArgumentOutOfRangeException value is negative.

See Also