diff options
author | Simon Ser <contact@emersion.fr> | 2022-02-08 09:52:24 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-02-08 09:20:13 -0500 |
commit | f707f583e17cb5e8323ceb4bfd951ad0465b7d10 (patch) | |
tree | 9de2eaecf63cb4f8e1c0af7ba1c7c9d7a8fd01a4 /swaynag/config.c | |
parent | ac7892371ce1ef7a05619492f0896f525b4dbdc3 (diff) |
Remove all sprintf calls
Replace them with snprintf, which ensures buffer overflows won't
happen.
Diffstat (limited to 'swaynag/config.c')
-rw-r--r-- | swaynag/config.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/swaynag/config.c b/swaynag/config.c index 6db7cce5..ede0938c 100644 --- a/swaynag/config.c +++ b/swaynag/config.c @@ -414,8 +414,8 @@ int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types) { } free(name); } else { - char *flag = malloc(sizeof(char) * (nread + 3)); - sprintf(flag, "--%s", line); + char *flag = malloc(nread + 3); + snprintf(flag, nread + 3, "--%s", line); char *argv[] = {"swaynag", flag}; result = swaynag_parse_options(2, argv, swaynag, types, type, NULL, NULL); |