Fix: ini parser: truncation of value name
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 Jan 2023 19:19:20 +0000 (14:19 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 31 May 2023 20:22:02 +0000 (16:22 -0400)
commit6415838fffb8294e0f8b5230449b260ea5eb1c38
treeb1cb6e02291235362ea57c77dba8b49922fdcd9c
parenta989d3e5aea516e321ebd6e021e7c3dedf215a21
Fix: ini parser: truncation of value name

clang 14 reports the following:

  ini-config/ini.cpp:88:16: warning: 'char* strncpy(char*, const char*, size_t)' output may be truncated copying 49 bytes from a string of length 199 [-Wstringop-truncation]
     88 |         strncpy(dest, src, size - 1);
        |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Indeed, a silent truncation of `name` occurs whenever it is longer than
prev_name (49 characters, excluding the terminator).

Report an error when this condition occurs.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I973bd27185e0130d8e4a452525d9277de45ba200
src/common/config/ini.c
This page took 0.027659 seconds and 4 git commands to generate.