diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-10 16:20:58 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-01-03 11:02:11 -0800 |
commit | e6821a8a7b16e5a8e4c478c9544798fae59a21d1 (patch) | |
tree | 80bdbd72a5ff3d4becaec1990281735a159c7fdb /geometry.c | |
parent | 81e46cab5f4bdd69fa0a644dba86f6902cece175 (diff) |
Handle -Wstringop-truncation warning in HandleOverlayDef()
In function ‘HandleOverlayDef’,
inlined from ‘HandleSectionBody’ at geometry.c:2778:18,
inlined from ‘HandleSectionDef’ at geometry.c:2818:10,
inlined from ‘HandleGeometryFile’ at geometry.c:2864:18:
geometry.c:2573:9: warning: ‘strncpy’ output may be truncated copying
4 bytes from a string of length 4 [-Wstringop-truncation]
2573 | strncpy(key->over, keyDef->over, XkbKeyNameLength);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
geometry.c:2574:9: warning: ‘strncpy’ output may be truncated copying
4 bytes from a string of length 4 [-Wstringop-truncation]
2574 | strncpy(key->under, keyDef->under, XkbKeyNameLength);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'geometry.c')
-rw-r--r-- | geometry.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2570,8 +2570,8 @@ HandleOverlayDef(OverlayDef * def, } return False; } - strncpy(key->over, keyDef->over, XkbKeyNameLength); - strncpy(key->under, keyDef->under, XkbKeyNameLength); + strncpy(key->over, keyDef->over, sizeof(key->over)); + strncpy(key->under, keyDef->under, sizeof(key->under)); key->sectionRow = _GOK_UnknownRow; key->overlayRow = _GOK_UnknownRow; ol.keys = (OverlayKeyInfo *) AddCommonInfo(&ol.keys->defs, |