An ubus RPC daemon for Liminix
Find a file
Petr Štetiar 82904bd4f9 sys: mitigate possible strncpy string truncation
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=stringop-truncation]
   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In function ‘strncpy’,
     inlined from ‘rpc_sys_packagelist’ at /opt/devel/openwrt/c-projects/rpcd/sys.c:227:4:
 /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 128 equals destination size [-Werror=stringop-truncation]
   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since it is not possible to avoid truncation by strncpy, it is necessary
to make sure the result of strncpy is properly NUL-terminated and the
NUL must be inserted explicitly, after strncpy has returned.

References: #10442
Reported-by: Alexey Smirnov <s.alexey@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-08-24 12:51:39 +02:00
examples/ucode ucode: parse ucode plugin scripts in raw mode, init search path 2022-08-12 21:14:27 +02:00
include/rpcd build: honour CMake install prefix in hardcoded paths 2021-12-08 20:09:24 +01:00
CMakeLists.txt ucode: add ucode interpreter plugin 2021-12-08 20:09:24 +01:00
exec.c exec: always call finish_cb to allow plugin to free up memory 2019-10-29 09:24:46 +01:00
file.c treewide: adjust ubus object type names 2021-12-08 20:09:24 +01:00
iwinfo.c iwinfo: fix compilation error with GCC 12 2022-05-31 19:44:26 +02:00
main.c rc: new ubus object for handling /etc/init.d/ scripts 2020-09-10 13:18:09 +02:00
plugin.c ucode: add ucode interpreter plugin 2021-12-08 20:09:24 +01:00
rc.c rc: support init.d scripts with START=0 2020-09-18 08:10:56 +02:00
session.c treewide: adjust ubus object type names 2021-12-08 20:09:24 +01:00
sys.c sys: mitigate possible strncpy string truncation 2022-08-24 12:51:39 +02:00
uci.c treewide: adjust ubus object type names 2021-12-08 20:09:24 +01:00
ucode.c ucode: parse ucode plugin scripts in raw mode, init search path 2022-08-12 21:14:27 +02:00
unauthenticated.json session: setup a persistent NULL section and implement login procedure 2013-09-10 19:56:36 +02:00