summaryrefslogtreecommitdiff
path: root/src/nl-cls-list.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-09 14:50:32 +0200
committerThomas Haller <thaller@redhat.com>2019-08-09 16:48:55 +0200
commitc5c0240ec4455cfbd404155c43e5ff0d60d3cca7 (patch)
tree100407896261715e549b7c43555f5c3d6feed753 /src/nl-cls-list.c
parentb2749acc019714bb739483cb94347a4f2cdc4450 (diff)
downloadlibnl-c5c0240ec4455cfbd404155c43e5ff0d60d3cca7.tar.gz
genl: reject invalid group names in genl_family_add_grp()
The compiler warns about string truncation: In function ‘genl_family_add_grp’, inlined from ‘family_clone’ at lib/genl/family.c:81:9, inlined from ‘family_clone’ at lib/genl/family.c:66:12: lib/genl/family.c:376:2: error: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 15 [-Werror=stringop-truncation] 376 | strncpy(grp->name, name, GENL_NAMSIZ - 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Obvioulsy, it's a bug to use an invalid group name. But better handle it by checking for a suitable string length. Also use _nl_strncpy() which asserts that no truncation occurs.
Diffstat (limited to 'src/nl-cls-list.c')
0 files changed, 0 insertions, 0 deletions