aboutsummaryrefslogtreecommitdiff
path: root/include/stringop.h
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-11-28 22:17:21 +0000
committerSimon Ser <contact@emersion.fr>2023-12-14 10:48:24 +0100
commit4683b53817d8618c6c42f98cb299866a96759f6e (patch)
tree12486e0cd9f38cd347d76b6e73cb5c307e5d6454 /include/stringop.h
parent064b279e9b04646e66165f1fab14f950d9d2b3df (diff)
sway/config.c: use `memcpy()` for known buffer size
`gcc-14` added a new warning around dangerous use of `strncpy()` withi known overflow: ../sway/config.c: In function 'do_var_replacement': ../sway/config.c:983:33: error: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Werror=stringop-truncation] 983 | strncpy(newptr, var->value, vvlen); | ^ ../sway/config.c:971:45: note: length computed here 971 | int vvlen = strlen(var->value); | ^~~~~~~~~~~~~~~~~~ It's a bit fishy to rely on truncating behaviour of `strncpy()`. The change uses `memcpy()` as more explicit way to express copy of `vvlen` bytes. (cherry picked from commit 2cd73a33c26ea6510a2f50359b1c550cd9b4fead)
Diffstat (limited to 'include/stringop.h')
0 files changed, 0 insertions, 0 deletions