Re: [PATCH rpcd] sys: mitigate possible strncpy string truncation

2022-08-24 Thread Jo-Philipp Wich
Hi, comment below. ~ Jo On 8/24/22 10:14 AM, Petr Štetiar wrote: > [...] > --- a/sys.c > +++ b/sys.c > @@ -224,7 +224,8 @@ procstr: > continue; > > if (!strcmp(var, "Package:")) { > - strncpy(pkg, p1, sizeof(pkg)); > +

[PATCH rpcd] sys: mitigate possible strncpy string truncation

2022-08-24 Thread Petr Štetiar
gcc 10 with -O2 reports following: In function ‘strncpy’, inlined from ‘rpc_sys_packagelist’ at /opt/devel/openwrt/c-projects/rpcd/sys.c:244:4: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 128 equals destination size [-Werror=st