From 0c5260a9a736df772d3f5847d519e8431f08c532 Mon Sep 17 00:00:00 2001 From: MFraters Date: Tue, 24 Feb 2015 11:32:07 +0100 Subject: [PATCH] empty string in split_string_list fix When an empty string or a string with only spaces is given to this function, the split_string_list function will ask in line 222 for name[-1], which will result in unpredictable behaviour. I propose to prevent this by adding a condition that the length of the string may not be 0. --- source/base/utilities.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 8af548922d..6507542bb7 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -219,7 +219,7 @@ namespace Utilities (name[0] == ' ')) name.erase (0,1); - while (name[name.length()-1] == ' ') + while (name[name.length()-1] == ' ' && name.length() != 0) name.erase (name.length()-1, 1); split_list.push_back (name); -- 2.39.5