Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Mitigate MediaType overflow #5677

Merged
merged 1 commit into from
Jan 13, 2017
Merged

Conversation

ryanbrandenburg
Copy link
Contributor

Fixes #5560 in the same way as e7a24a1f8.

{
throw new ArgumentOutOfRangeException(nameof(length));
}

if (offset > mediaType.Length - length)
{
// TODO: This isn't necessarily length's fault but changing this to an ArgumentException with the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

@ryanbrandenburg ryanbrandenburg force-pushed the rybrande/MediaTypeOverflow branch from 04d4384 to 3fb2e10 Compare January 12, 2017 00:30
@ryanbrandenburg
Copy link
Contributor Author

🆙📅

@@ -387,4 +387,7 @@
<value>Unable to create an instance of type '{0}'. The type specified in {1} must not be abstract and must have a parameterless constructor.</value>
<comment>0 is the type to configure. 1 is the name of the parameter, configurationType.</comment>
</data>
<data name="Argument_InvalidOffsetLength" xml:space="preserve">
<value>Offset and length are out of bounds for the string or length is greater than the number of characters from index to the end of the string.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should pass in the names of the parameters and surround them with single quotes. Don't put "code names" in resources because they should not be translated.

@ryanbrandenburg
Copy link
Contributor Author

🆙📅

@@ -387,4 +387,8 @@
<value>Unable to create an instance of type '{0}'. The type specified in {1} must not be abstract and must have a parameterless constructor.</value>
<comment>0 is the type to configure. 1 is the name of the parameter, configurationType.</comment>
</data>
<data name="Argument_InvalidOffsetLength" xml:space="preserve">
<value>{0} and {1} are out of bounds for the string.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put single quotes around the parameters to make it clear that you're referring to the parameter by name.

@ryanbrandenburg ryanbrandenburg force-pushed the rybrande/MediaTypeOverflow branch from a4604d9 to 76a1a46 Compare January 13, 2017 20:50
@ryanbrandenburg ryanbrandenburg force-pushed the rybrande/MediaTypeOverflow branch from 76a1a46 to 93774a0 Compare January 13, 2017 20:51
@ryanbrandenburg ryanbrandenburg merged commit 93774a0 into dev Jan 13, 2017
@ryanbrandenburg ryanbrandenburg deleted the rybrande/MediaTypeOverflow branch January 13, 2017 20:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants