From fb33db8bb59ce6282478d1c251bef2d7671d2a91 Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Mon, 18 Sep 2023 13:22:40 +0300 Subject: [PATCH] imp - Fixed out of bounds in some cases We've fixed out of bounds when trying to split keys and values. --- We've fixed out of bounds when trying to split keys and values in certain situations. This can be easily reproduced by importing a contact with a picture to Nitrocid KS, which internally uses the SaveTo() and Parse() functions for verification. --- Type: imp Breaking: False Doc Required: False Part: 1/1 --- VisualCard/Parsers/VcardParserTools.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VisualCard/Parsers/VcardParserTools.cs b/VisualCard/Parsers/VcardParserTools.cs index 05bc6f2..141e177 100644 --- a/VisualCard/Parsers/VcardParserTools.cs +++ b/VisualCard/Parsers/VcardParserTools.cs @@ -91,6 +91,8 @@ internal static string[] GetValues(string[] args, string @default, string argSpe internal static string[] SplitToKeyAndValueFromString(string line) { + if (line.IndexOf(':') < 0) + return new[] { line, "" }; string key = line.Substring(0, line.IndexOf(':')); string value = line.Substring(line.IndexOf(':')); return new[] { key, value };