From: Thomas Jarosch Date: Mon, 27 Mar 2006 15:17:52 +0000 (+0000) Subject: libi2ncommon: (tomj) throw exception if replace_all is called with empty search strin... X-Git-Tag: v2.6~215 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=1ec2064efc7ab25de2c163b0f6263045a79cbbea;p=libi2ncommon libi2ncommon: (tomj) throw exception if replace_all is called with empty search string (leads to OOM otherwise) --- diff --git a/src/stringfunc.cpp b/src/stringfunc.cpp index dcc1cde..199b277 100644 --- a/src/stringfunc.cpp +++ b/src/stringfunc.cpp @@ -162,6 +162,9 @@ bool replace_all(string &base, const string &ist, const string &soll) bool found_ist = false; string::size_type a=0; + if (ist.empty()) + throw runtime_error("replace_all called with empty search string"); + while((a=base.find(ist,a))!=string::npos) { base.replace(a,ist.size(),soll);