Ticket 28: SIGSEGV received while parsing config file
When using fsl, logging configuration is read from a file with a well-known format using libcfg. If this config file has a block (see used config file..block starts at "ident (.+)/local7 q{" and ends in "};") that is longer than 1035, a segfault is caused. Attached you can find the file I used as a config file and a very simple test program, as well as the modified section of code from libcfg that helped me pinpooint the source. If you run this program with this config (compiilng with libfsl of course) you should get the same results.
I traced the problem with gdb and managed to pin-point it to line 1233 in
cfg_syn_scan.c (same as line 255 of cfg_syn_scan.l). This line is:
yylval->cpString = strdup(caStr);
I inserted some print statments to test and discovered that the cause is that yylval in this case is a NULL pointer or an invalid address.Whenever I delete a single character from my config file (in any config line of the section) the segfault goes away. That's how I deduced the limit to be 1035 chars in the section before the segfault (ie. 1036 causes a segfault). Strangely enough, if I add a couple of more chars.. my debug line doesn't even show!
Any prompt help regarding a workaround or a fix would be most appreciated.
Remarks:
Properties:
Type: |
code |
|
Version: |
0.9.1 |
Status: |
new |
|
Created: |
2004-Jan-10 00:38 |
Severity: |
1 |
|
Last Change: |
2004-Jan-10 00:38 |
Priority: |
1 |
|
Subsystem: |
cfg |
Assigned To: |
rse |
|
Derived From: |
|
Creator: |
anonymous |
Attachments:
- ticket
2279 bytes added by anonymous on 2004-Jan-09 23:39:14 UTC.
- log_alert.conf
1480 bytes added by anonymous on 2004-Jan-09 23:40:53 UTC.
- bug_cfg.c
132 bytes added by anonymous on 2004-Jan-09 23:41:41 UTC.