confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Confuse-devel] core dump on config parse


From: Ben
Subject: [Confuse-devel] core dump on config parse
Date: Tue, 6 May 2008 13:07:02 -0700 (GMT-07:00)

Hello,

It seems as though I've either run into a bug in Confuse or I'm doing something 
completely wrong.  My application is segfaulting when parsing the following 
config (segfaulting on a cfg_getstr() call):

attack example {
        application     = "Example Application"
        version         = "1.0"
        description     = "This is an example application entry."
        order           = {"identifier", "foobar"}
        stage identifier {
                target          = "index.php"
                method          = "post"
                modules             = {"query", "parse", "output"}
                query {
                        request         = "foo=!c&topicid=!t&blah=1"
                        options         = {"c", "t"}
                        descriptions    = {"Command", "Topic ID"}
                        cookies         = {"foobar", "user"}
                        data                    = {"some cookie data", "!c"}
                }
                parse {
                        regex   = {"^<FOOBAR>.*</FOOBAR>$", 
"([a-zA-Z0-9]){32,32}"}
                }
                output {
                        stdout  = "null"
                        stderr  = "debug"
                }
        }
        stage foobar {
                target  = "postback.php"
                method  = "post"
                modules = {"sql", "output"}
                sql {
                        # segfaults on action
                        action = "enumerate"
                        request = "topicid=!t&blah=1"
                        enumerate       = "foo"
                        options         = {"t"}
                        descriptions    = {"Topic ID"}
                }
                output {
                        stdout  = "console"
                        stdout  = "debug"
                }
        }
}

It dies on action = "enumerate" inside the sql{} section.

Here is my config definition:

cfg_opt_t opts_query[] = {
        CFG_STR("request", NULL, CFGF_NONE),
        CFG_STR_LIST("options", NULL, CFGF_NONE),
        CFG_STR_LIST("descriptions", NULL, CFGF_NONE),
        CFG_STR_LIST("cookies", NULL, CFGF_NONE),
        CFG_STR_LIST("data", NULL, CFGF_NONE),
        CFG_END()
};

cfg_opt_t opts_parse[] = {
        CFG_STR_LIST("regex", NULL, CFGF_NONE),
        CFG_END()
};

cfg_opt_t opts_output[] = {
        CFG_STR("stdout", NULL, CFGF_NONE),
        CFG_STR("stderr", NULL, CFGF_NONE),
        CFG_END()
};

cfg_opt_t opts_sql[] = {
                CFG_STR("action", NULL, CFGF_NONE),
                CFG_STR("request", NULL, CFGF_NONE),
                CFG_STR("enumerate", NULL, CFGF_NONE),
                CFG_STR_LIST("options", NULL, CFGF_NONE),
                CFG_STR_LIST("descriptions", NULL, CFGF_NONE),
                CFG_END()
};

cfg_opt_t opts_stage[] = {
                CFG_STR("target", NULL, CFGF_NONE),
                CFG_STR("method", NULL, CFGF_NONE),
                CFG_STR_LIST("modules", NULL, CFGF_NONE),
                CFG_SEC("query", opts_query, CFGF_NONE),
                CFG_SEC("parse", opts_parse, CFGF_NONE),
                CFG_SEC("output", opts_output, CFGF_NONE),
                CFG_SEC("sql", opts_sql, CFGF_NONE),
                CFG_END()
};

cfg_opt_t opts_attack[] = {
                CFG_STR("application", NULL, CFGF_NONE),
                CFG_STR("version", NULL, CFGF_NONE),
                CFG_STR("description", NULL, CFGF_NONE),
                CFG_STR_LIST("order", NULL, CFGF_NONE),
                CFG_SEC("stage", opts_stage, CFGF_MULTI | CFGF_TITLE),
                CFG_END()
};

cfg_opt_t opts[] = {
                CFG_SEC("attack", opts_attack, CFGF_MULTI | CFGF_TITLE),
                CFG_END()
};


And here is the psuedo-code of how I'm attempting to parse this config:

foreach(module) {
    store some values
    foreach(stage) {
        sql = cfg_getsec(stage, "sql");
        var = cfg_getstr(sql, "action");  <-- crashes here
    }
}



Any help would be greatly appreciated.  Let me know if any additional 
information is needed.  The dev system 

Thanks in advance,
Ben




reply via email to

[Prev in Thread] Current Thread [Next in Thread]