[PATCH] umdns: fix compilation with GCC 10
Petr Štetiar
ynezz at true.cz
Mon Aug 31 03:08:33 EDT 2020
Rosen Penev <rosenp at 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 <rosenp at 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
More information about the openwrt-devel
mailing list