Hi Marius,
On Wed, 21 Feb 2018 at 14:38, Marius Vlad <marius-cristian.v...@nxp.com> wrote:
> @@ -456,6 +457,10 @@ weston_config_parse(const char *name)
>                         section = config_add_section(config, &line[1]);
>                         continue;
>                 default:
> +                       start_line = stop_line = line;
> +                       while (stop_line && *stop_line != ' ' && *stop_line 
> != '\t')

Should this be *stop_line? The pointer itself will never be NULL, so
it seems like this might read a long way out of bounds.

> @@ -474,7 +479,9 @@ weston_config_parse(const char *name)
>                                 p[i - 1] = '\0';
>                                 i--;
>                         }
> -                       section_add_entry(section, line, p);
> +
> +                       start_line[stop_line - start_line] = '\0';

I think you could remove the start_line variable and continue to just
use 'line' here, if you simplified this to *stop_line = '\0';

This should also have a few tests in config-parser-test.

Cheers,
Daniel
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to