[Devel] fuse: fix junk at in kio name

Alexey Kuznetsov kuznet at virtuozzo.com
Tue Aug 31 16:58:25 MSK 2021


Hello!

On Tue, Aug 31, 2021 at 9:37 PM Pavel Tikhomirov
<ptikhomirov at virtuozzo.com> wrote:
> Please take a look on OPT_SUBTYPE and OPT_SOURCE options, do we actually
> need strncpy here?

Formally, сheck if (param->size > FUSE_KIO_NAME) must be enough.

But better be safe than sorry. In this particular context we have no idea
that param->size is correlated to actual string length. You may believe
to caller, I would not.


> vfs_parse_fs_string with it's kmemdup_nul already
> puts null-terminated string in param.string, similarly null-terminated
> string is provided by sys_fsconfig with strndup_user(_value, 256);

Wrong! If you copy OPT_SUBTYPE or OPT_SOURCE
to a buffer you use strncpy limited to sizeof of your local buffer
no matter what is written on that fence :-)



More information about the Devel mailing list