[PATCH] umdns: fix compilation with GCC 10
Rosen Penev
rosenp at gmail.com
Mon Aug 31 05:06:50 EDT 2020
Sent from my iPhone
> On Aug 31, 2020, at 01:29, Petr Štetiar <ynezz at true.cz> wrote:
>
> Rosen Penev <rosenp at gmail.com> [2020-08-31 00:53:32]:
>
>>>> /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?
>> GCC10?
>
> I've `gcc-10 (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0` and I'm afraid, thats not
> enough. I've tried to compile it with following:
>
> /usr/bin/gcc-10 -D_FORTIFY_SOURCE=2 -I/opt/devel/openwrt/testing/include -g -Os
> -ggdb -Wextra -Wall -Werror --std=gnu99 -Wmissing-declarations
> -Wno-unused-parameter -fstack-protector-strong -Wformat -Werror=format-security
> -o CMakeFiles/umdns.dir/service.c.o -c /opt/devel/openwrt/c-projects/mdnsd/service.c
>
> which "just" yields following errors in service.c:
>
> service.c:110:10: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
> service.c:279:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
I compile with target GCC 10, not host.
>
> -- ynezz
More information about the openwrt-devel
mailing list