diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-23 20:17:41 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-23 21:38:52 +0100 |
commit | 6d6e063a0fd132c49490f01949dfa5fa28125a33 (patch) | |
tree | 686b83d884b47588f8f43ce0f3d2efaf4075ba7f /libdm/libdm-report.c | |
parent | eccc91f9b0ef7387f46cdd93e3f44ab45e0c1ba3 (diff) | |
download | lvm2-6d6e063a0fd132c49490f01949dfa5fa28125a33.tar.gz |
libdm: fix string boundary
The test for string 'end' needs to account for ending \0,
which also needs to fit <SIZE.
Diffstat (limited to 'libdm/libdm-report.c')
-rw-r--r-- | libdm/libdm-report.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index 55b5ff0e3..0163910d3 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -839,8 +839,9 @@ static int _get_canonical_field_name(const char *field, diff = 1; continue; } - if (i >= fcanonical_len) { - log_error("%s: field name too long", field); + if ((i + 1) >= fcanonical_len) { + canonical_field[0] = '\0'; + log_error("%s: field name too long.", field); return 0; } canonical_field[i++] = *field; |