1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: fix string boundary

The test for string 'end' needs to account for ending \0,
which also needs to fit <SIZE.
This commit is contained in:
Zdenek Kabelac 2016-02-23 20:17:41 +01:00
parent eccc91f9b0
commit 6d6e063a0f
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.118 -
=====================================
Fix string boundary check in _get_canonical_field_name().
Always initialized hist struct in _stats_parse_histogram().
Version 1.02.117 - 21st February 2016

View File

@ -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;