Menu

#30 get_config_* NULL section name bug

closed
nobody
None
9
2012-10-09
2001-07-27
No

This was a bug that was revealed by the changes in
the latest WIP.

This happens when one passes NULL as the section name
to a get_config_* function with the exception of
get_config_string. For instance when one calls
get_config_int with a NULL section name, it would
call get_config_string -- but it will pass an epmty
string as the section name. Then get_config_string
calls prettify_section_name with the empty string.
prettify_section_name would then blindly place the
braces in the empty string. This results in a string
containing '[]'.

The patch fixes this by having prettify_section_name
check the length of the string. It will not modify
the string if it is empty, which I hope is TRT. As
Eric Botcazou puts it, an insane user might pass a
'[]' as the section name. This is indeed insane,
though it would be useful to have the config routines
place variables under a '[]' section in the global
section. Hence '[]' would stand for ``NULL section'',
and therefore allow one to specify global variables
anywhere within the config file.

Under the current circumstances I've had instances
where this bug caused a segfault--surprisingly with
no core dump so I couldn't bt with GDB :-(

Discussion

  • Nimrod A. Abing

    Nimrod A. Abing - 2001-07-27

    diff patch

     
  • Eric Botcazou

    Eric Botcazou - 2001-07-31

    Logged In: YES
    user_id=113920

    Your fix is now in the tree.
    -Eric

     

Log in to post a comment.