diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-05-06 08:29:48 +0300 |
---|---|---|
committer | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2020-09-29 09:12:57 -0400 |
commit | 5c9b955fdc55e3cd4ba4696dbd1eb7fcb19c7a12 (patch) | |
tree | de9c2954f67e3ebdbdd7d9ca28506dca99760465 | |
parent | 24d35b7d031dd34ceae4816087a49038033552c8 (diff) |
features/bit-rot: invalid snprintf() buffer size
Found with clang-10 -Wfortify-source:
bit-rot-scrub.c:1802:15: warning: 'snprintf' size argument is too large;
destination buffer has size 32, but size argument is 4096 [-Wfortify-source]
len = snprintf(key, PATH_MAX, "quarantine-%d", j);
^
bit-rot-scrub.c:1813:9: warning: 'snprintf' size argument is too large;
destination buffer has size 32, but size argument is 4096 [-Wfortify-source]
snprintf(main_key, PATH_MAX, "quarantine-%d", tmp_count);
Change-Id: I9b9c09ef2223ed181d81215154345de976b82f13
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Fixes: #1221
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index d20ecc7cdbe..10c0478f2e8 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -1799,7 +1799,7 @@ br_collect_bad_objects_of_child(xlator_t *this, br_child_t *child, dict_t *dict, tmp_count = total_count; for (j = 0; j < count; j++) { - len = snprintf(key, PATH_MAX, "quarantine-%d", j); + len = snprintf(key, sizeof(key), "quarantine-%d", j); ret = dict_get_strn(child_dict, key, len, &entry); if (ret) continue; @@ -1810,7 +1810,7 @@ br_collect_bad_objects_of_child(xlator_t *this, br_child_t *child, dict_t *dict, if ((len < 0) || (len >= PATH_MAX)) { continue; } - snprintf(main_key, PATH_MAX, "quarantine-%d", tmp_count); + snprintf(main_key, sizeof(main_key), "quarantine-%d", tmp_count); ret = dict_set_dynstr_with_alloc(dict, main_key, tmp); if (!ret) |