Re: [AD] config file patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> This patch removes buffer truncations in config.c
>
> Four functions are modified:
>  get_line: a config file line used to be truncated to 255 characters
>  set_config: small modifications because get_line parameters have changed
> (set_config calls get_line)
>  get_config_argv: the config value used to be truncated to 255 characters
>  get_config_text: the message used to be truncated to 255 characters
>
> Potential incompatibilities:
>  If client code relies on the fact that strings are truncated

Ouch! Really scary.

>  Functions can fail because the program is out of memory. In this case they
> will behave as if the entry didn't exist in the config file (I hope)
>
> Remarks:
>  Config file names are still limited to 1024 bytes
>  Section names are still limited to 256 bytes

Applied with two modifications:
- using _al_sane_realloc (from src/libc.c) instead of realloc,
- setting *allegro_errno = ENOMEM on memory failures.

-- 
Eric Botcazou



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/