[PATCH] readprofile-tained-ptr

Xabier Oneca -- xOneca xoneca at gmail.com
Tue Mar 4 17:30:43 UTC 2025


Hi Sergey,

>  busybox/util-linux/readprofile.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/busybox/util-linux/readprofile.c b/busybox/util-linux/readprofile.c
> index f11c622..a11fe95 100644
> --- a/busybox/util-linux/readprofile.c
> +++ b/busybox/util-linux/readprofile.c
> @@ -248,7 +248,10 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
>                 }
>
>                 fn_add = next_add;
> -               strcpy(fn_name, next_name);
> +               if (strlen(next_name) < S_LEN) {
> +                       strncpy(fn_name, next_name, S_LEN - 1);
> +                       fn_name[S_LEN - 1] = '\0';
> +               }
>
>                 maplineno++;
>         }
> --
> 2.30.2

I don't think this patch is really needed. fn_name and next_name are
defined as the same size (S_LEN). In fact, next_name comes from a
parsed field in mapline, which is also the same size. So, in the worst
case, next_name will never be bigger than fn_name.

Yours,

Xabier Oneca_,,_


More information about the busybox mailing list