From 3011838fe9796f24ad3d197057890042b527ef9d Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Wed, 5 Nov 2008 16:15:59 +0000 Subject: Fix calculation of extra-opts parameters. By reading the current list instead of the additional one when counting parameters, extra-opts calculation was allocating insuficient space for the final array if later sections contained more arguments than the sum of all previously parsed sections. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2069 f882894a-f735-0410-b71e-b25c423dba1c --- lib/extra_opts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/extra_opts.c') diff --git a/lib/extra_opts.c b/lib/extra_opts.c index b555417a..7e50c178 100644 --- a/lib/extra_opts.c +++ b/lib/extra_opts.c @@ -103,14 +103,13 @@ char **np_extra_opts(int *argc, char **argv, const char *plugin_name){ ea_tmp=extra_args; while(ea_tmp->next) { ea_tmp=ea_tmp->next; - ea_num++; } ea_tmp->next=ea1; + while(ea1=ea1->next) ea_num++; } ea1=ea_tmp=NULL; } - /* lather, rince, repeat */ - } + } /* lather, rince, repeat */ if(ea_num==*argc && extra_args==NULL){ /* No extra-opts */ -- cgit v1.2.3