fix: Potential JSON under-read fix

This commit is contained in:
Chris Cameron
2019-08-07 17:34:07 -04:00
parent 02e6fe9f8c
commit ff6f15d3ef

View File

@@ -155,9 +155,14 @@ namespace ICD.Common.Utils.Extensions
while (reader.TokenType != JsonToken.EndObject) while (reader.TokenType != JsonToken.EndObject)
{ {
if (reader.TokenType != JsonToken.PropertyName) if (reader.TokenType != JsonToken.PropertyName)
throw new FormatException(); throw new FormatException(string.Format("Expected token {0} got {1}", JsonToken.PropertyName, reader.TokenType));
switch ((string)reader.Value) string propertyName = (string)reader.Value;
// Step into the value
reader.Read();
switch (propertyName)
{ {
case PROPERTY_KEY: case PROPERTY_KEY:
key = readKey(extends, reader); key = readKey(extends, reader);