Mailing List Archive

I got a segfault... minor patch to config.c
If you run dbmail-adduser without a configuration file, it will segfault.
I tracked this down to an list that had never been through list_init().

Applying this trivial patch fixes the problem by init'ing the list even if
GetConfigValue() ends up bailing due to missing config file.

Please apply to CVS at your earliest convenience :-)

Aaron


*** dbmail/config.c 2003-03-17 08:04:08.000000000 -0800
--- dbmail-aaron/config.c 2003-05-14 02:04:50.000000000 -0700
***************
*** 44,57 ****

snprintf(service, LINESIZE, "[%s]", serviceName);

if ( !(cfile = fopen(cfilename, "r")) )
{
trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open config file [%s]", cfilename);
return -1;
}

- list_init(items);
-
do
{
fgets(line, LINESIZE, cfile);
--- 44,58 ----

snprintf(service, LINESIZE, "[%s]", serviceName);

+ /* Everything later on relies on this list being initialized! */
+ list_init(items);
+
if ( !(cfile = fopen(cfilename, "r")) )
{
trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open config file [%s]", cfilename);
return -1;
}

do
{
fgets(line, LINESIZE, cfile);
Re: I got a segfault... minor patch to config.c [ In reply to ]
Just wondering, while there were a few other CVS updates being made, if
this issue/patch had been reviewed yet...

Thanks,
Aaron


On Wed, 14 May 2003, Aaron Stone wrote:

> If you run dbmail-adduser without a configuration file, it will segfault.
> I tracked this down to an list that had never been through list_init().
>
> Applying this trivial patch fixes the problem by init'ing the list even if
> GetConfigValue() ends up bailing due to missing config file.
>
> Please apply to CVS at your earliest convenience :-)
>
> Aaron
>
>
> *** dbmail/config.c 2003-03-17 08:04:08.000000000 -0800
> --- dbmail-aaron/config.c 2003-05-14 02:04:50.000000000 -0700
> ***************
> *** 44,57 ****
>
> snprintf(service, LINESIZE, "[%s]", serviceName);
>
> if ( !(cfile = fopen(cfilename, "r")) )
> {
> trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open config file [%s]", cfilename);
> return -1;
> }
>
> - list_init(items);
> -
> do
> {
> fgets(line, LINESIZE, cfile);
> --- 44,58 ----
>
> snprintf(service, LINESIZE, "[%s]", serviceName);
>
> + /* Everything later on relies on this list being initialized! */
> + list_init(items);
> +
> if ( !(cfile = fopen(cfilename, "r")) )
> {
> trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open config file [%s]", cfilename);
> return -1;
> }
>
> do
> {
> fgets(line, LINESIZE, cfile);
>
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>
Re: I got a segfault... minor patch to config.c [ In reply to ]
just included, sorry for the delay

regards roel

Aaron Stone heeft op dinsdag, 27 mei 2003 om 05:33 (Europe/Amsterdam)
het volgende geschreven:

> Just wondering, while there were a few other CVS updates being made, if
> this issue/patch had been reviewed yet...
>
> Thanks,
> Aaron
>
>
> On Wed, 14 May 2003, Aaron Stone wrote:
>
>> If you run dbmail-adduser without a configuration file, it will
>> segfault.
>> I tracked this down to an list that had never been through
>> list_init().
>>
>> Applying this trivial patch fixes the problem by init'ing the list
>> even if
>> GetConfigValue() ends up bailing due to missing config file.
>>
>> Please apply to CVS at your earliest convenience :-)
>>
>> Aaron
>>
>>
>> *** dbmail/config.c 2003-03-17 08:04:08.000000000 -0800
>> --- dbmail-aaron/config.c 2003-05-14 02:04:50.000000000 -0700
>> ***************
>> *** 44,57 ****
>>
>> snprintf(service, LINESIZE, "[%s]", serviceName);
>>
>> if ( !(cfile = fopen(cfilename, "r")) )
>> {
>> trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open
>> config file [%s]", cfilename);
>> return -1;
>> }
>>
>> - list_init(items);
>> -
>> do
>> {
>> fgets(line, LINESIZE, cfile);
>> --- 44,58 ----
>>
>> snprintf(service, LINESIZE, "[%s]", serviceName);
>>
>> + /* Everything later on relies on this list being initialized! */
>> + list_init(items);
>> +
>> if ( !(cfile = fopen(cfilename, "r")) )
>> {
>> trace(CONFIG_ERROR_LEVEL, "ReadConfig(): could not open
>> config file [%s]", cfilename);
>> return -1;
>> }
>>
>> do
>> {
>> fgets(line, LINESIZE, cfile);
>>
>>
>> _______________________________________________
>> Dbmail-dev mailing list
>> Dbmail-dev@dbmail.org
>> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>>
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>

_________________________
R.A. Rozendaal
IC&S
T: +31 30 2322878
F: +31 30 2322305
www.ic-s.nl