From 089821fb58411044200fbf228e127b01b74a3361 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Mon, 4 Jan 2010 10:21:01 +0100 Subject: [PATCH] zsh: fix infinite loop. --- extras/analyser/zsh.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/extras/analyser/zsh.cpp b/extras/analyser/zsh.cpp index 7eb2bf23c1..249f812f44 100644 --- a/extras/analyser/zsh.cpp +++ b/extras/analyser/zsh.cpp @@ -224,14 +224,15 @@ void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 ) { std::pair range = mods.equal_range( p_item->psz_type ); std::string list = (*range.first).second; - ++range.first; - while( range.first != range.second ) + if( range.first != range.second ) { - list = list.append( " " ); - list = list.append( range.first->second ); - ++range.first; + while( range.first++ != range.second ) + { + list = list.append( " " ); + list = list.append( range.first->second ); + } + asprintf( &psz_arguments, "(%s)", list.c_str() ); } - asprintf( &psz_arguments, "(%s)", list.c_str() ); } break; case CONFIG_ITEM_MODULE_CAT: @@ -239,14 +240,15 @@ void ParseOption( module_config_t *p_item, mumap &mods, mcmap &mods2 ) std::pair range = mods2.equal_range( p_item->min.i ); std::string list = (*range.first).second; - ++range.first; - while( range.first != range.second ) + if( range.first != range.second ) { - list = list.append( " " ); - list = list.append( range.first->second ); - ++range.first; + while( range.first++ != range.second ) + { + list = list.append( " " ); + list = list.append( range.first->second ); + } + asprintf( &psz_arguments, "(%s)", list.c_str() ); } - asprintf( &psz_arguments, "(%s)", list.c_str() ); } break; case CONFIG_ITEM_MODULE_LIST_CAT: -- 2.39.5