From ff6f15d3efba74209039f2aef1aaf940c8b6cc23 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Wed, 7 Aug 2019 17:34:07 -0400 Subject: [PATCH] fix: Potential JSON under-read fix --- ICD.Common.Utils/Extensions/JsonSerializerExtensions.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/Extensions/JsonSerializerExtensions.cs b/ICD.Common.Utils/Extensions/JsonSerializerExtensions.cs index 7cc93a2..5abd7f9 100644 --- a/ICD.Common.Utils/Extensions/JsonSerializerExtensions.cs +++ b/ICD.Common.Utils/Extensions/JsonSerializerExtensions.cs @@ -155,9 +155,14 @@ namespace ICD.Common.Utils.Extensions while (reader.TokenType != JsonToken.EndObject) { 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: key = readKey(extends, reader);