diff options
author | emersion <contact@emersion.fr> | 2018-06-08 14:41:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-08 14:41:33 +0100 |
commit | acf71fe8053efadbfb81d2ea010ac6facf41cd81 (patch) | |
tree | 5ab5de782cb49f868eed29f3e7b2db6eb21b5547 | |
parent | Merge pull request #2120 from martinetd/swayidle-zombies (diff) | |
parent | sway/criteria: gcc string truncation warning fix (diff) | |
download | sway-acf71fe8053efadbfb81d2ea010ac6facf41cd81.tar.gz sway-acf71fe8053efadbfb81d2ea010ac6facf41cd81.tar.zst sway-acf71fe8053efadbfb81d2ea010ac6facf41cd81.zip |
Merge pull request #2119 from martinetd/gcc-strtruncation
sway/criteria: gcc string truncation warning fix
-rw-r--r-- | sway/criteria.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/criteria.c b/sway/criteria.c index a263485a..d9f09ecc 100644 --- a/sway/criteria.c +++ b/sway/criteria.c | |||
@@ -472,7 +472,9 @@ struct criteria *criteria_parse(char *raw, char **error_arg) { | |||
472 | ++head; | 472 | ++head; |
473 | } | 473 | } |
474 | name = calloc(head - namestart + 1, 1); | 474 | name = calloc(head - namestart + 1, 1); |
475 | strncpy(name, namestart, head - namestart); | 475 | if (head != namestart) { |
476 | strncpy(name, namestart, head - namestart); | ||
477 | } | ||
476 | // Parse token value | 478 | // Parse token value |
477 | skip_spaces(&head); | 479 | skip_spaces(&head); |
478 | value = NULL; | 480 | value = NULL; |