On Fri, 06.02.15 16:46, Maciej Wereski (m.were...@partner.samsung.com) wrote:

> ---
>  src/core/load-fragment.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
> index 90bf563..6108d12 100644
> --- a/src/core/load-fragment.c
> +++ b/src/core/load-fragment.c
> @@ -1203,21 +1203,15 @@ int config_parse_exec_mount_flags(const char *unit,
>          assert(data);
>  
>          FOREACH_WORD_SEPARATOR(word, l, rvalue, ", ", state) {
> -                _cleanup_free_ char *t;
> -
> -                t = strndup(word, l);
> -                if (!t)
> -                        return log_oom();
> -
> -                if (streq(t, "shared"))
> +                if (strneq(word, "shared", l))
>                          flags = MS_SHARED;
> -                else if (streq(t, "slave"))
> +                else if (strneq(word, "slave", l))
>                          flags = MS_SLAVE;
> -                else if (streq(word, "private"))
> +                else if (strneq(word, "private", l))
>                          flags = MS_PRIVATE;

This optimization is not valid.

If 'word' is set to "sh", then l will be 2, and strneq(word, "shared",
2) is true, but we don't actually want to allow such abbreviations!

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to