jimmywei
Joined: 10 Jan 2008 Posts: 8
|
Posted: Mon Jan 14, 2008 10:22 am Post subject: Segmentation fault while parsing config |
|
|
miniupnpd: miniupnpd-1.0-RC13
file:option.c
platform:Fedora Core 3
I am using default config with some modification (listening ip...)
I noticed that sometimes it crashes... (Segmentation fault), and i try to find out what was wrong, i found that if it crashed, it always crashed when parsing an empty line in configuration file line 7,
for example:
in default config,
line 6 #ext_ip=
line 7
line 8 # there can be ...
it crashed in parsing line 7
then i add
while(fgets(buffer, sizeof(buffer),hfile))
{
linenum++;
t=strchr(buffer,'\n');
if(t)
{
*t='\0';
t--;
if(t<=buffer)
continue;
while(isspace(*t))
{
...
then tried many times, it did not crash
I don't know if this is right,
Hope this would be helpful |
|