Rosen Penev <ros...@gmail.com> [2020-08-30 15:07:03]:

Hi,

> /service.c:242:10: error: 'strncpy' offset 6 from the object at 'b' is
> out of the bounds of referenced subobject 'name' with type 'uint8_t[]'
>  {aka 'unsigned char[]'} at offset 6 [-Werror=array-bounds]
> 242 | s->id = strncpy(d_id, blobmsg_name(b), n);

how could one reproduce this error message?

> Signed-off-by: Rosen Penev <ros...@gmail.com>
> ---
>  service.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/service.c b/service.c
> index 53f44c1..e649b64 100644
> --- a/service.c
> +++ b/service.c
> @@ -240,7 +240,7 @@ service_load_blob(struct blob_attr *b)
>               return;
>  
>       s->port = blobmsg_get_u32(_tb[SERVICE_PORT]);
> -     s->id = strncpy(d_id, blobmsg_name(b), n);
> +     s->id = memcpy(d_id, blobmsg_name(b), n);

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to