diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-15 14:45:16 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-15 17:49:44 +0200 |
commit | 20971f7034cbd329f873e08869bfb7acf3f1ac0e (patch) | |
tree | 4abb49c9f6d12de277fcc1ca44a2c757e79b077e /libdm | |
parent | 77aa055e8a34eb7f0036b6240f3f93dc429c0c02 (diff) | |
download | lvm2-20971f7034cbd329f873e08869bfb7acf3f1ac0e.tar.gz |
cov: dm stats missed terminating null
Coverity noticed allocating insufficient memory
for the terminating null of the string.
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/libdm-stats.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index e9bfa9de9..ea8fdf2ef 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -1009,7 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp) * dm_task_get_message_response() returns a 'const char *' but * since fmemopen also permits "w" it expects a 'char *'. */ - if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r"))) + if (!(list_rows = fmemopen((char *)resp, strlen(resp) + 1, "r"))) return_0; /* begin region table */ @@ -1240,7 +1240,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp, * dm_task_get_message_response() returns a 'const char *' but * since fmemopen also permits "w" it expects a 'char *'. */ - stats_rows = fmemopen((char *)resp, strlen(resp), "r"); + stats_rows = fmemopen((char *)resp, strlen(resp) + 1, "r"); if (!stats_rows) goto_bad; |