Ack from me.
Not tested. It's obvious that "rc" check is missing if "isCmdLn" is set to true.

Best regards,
Zoran


-----Original Message-----
From: reddy.neelaka...@oracle.com [mailto:reddy.neelaka...@oracle.com] 
Sent: Tuesday, April 28, 2015 3:08 PM
To: Zoran Milinkovic
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] immtools: corrected segmentation fault in immcg when 
illegal character is given [#1351]

 osaf/tools/safimm/immcfg/imm_cfg.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


In case of success wordexp returns 0. In error cases accessing wordexp_t 
structure is illegal

diff --git a/osaf/tools/safimm/immcfg/imm_cfg.c 
b/osaf/tools/safimm/immcfg/imm_cfg.c
--- a/osaf/tools/safimm/immcfg/imm_cfg.c
+++ b/osaf/tools/safimm/immcfg/imm_cfg.c
@@ -1098,7 +1098,8 @@ static int start_cmd() {
                        }
                }
 
-               if(p.we_wordc > 0) {
+
+               if(rc==0 && p.we_wordc > 0) {
                        if(!strcmp(p.we_wordv[0], "immcfg")) {
                                optind = 0;
                                if((rc = imm_operation(p.we_wordc, p.we_wordv)) 
&& !isCmdLn) { @@ -1109,10 +1110,9 @@ static int start_cmd() {
                                alarm(0);
                        } else
                                fprintf(stderr, "Not immcfg command\n");
+                       wordfree(&p);
                }
-
-               wordfree(&p);
-
+       
 done:
                if(line) {
                        free(line);

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to