mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: dm stats missed terminating null
Coverity noticed allocating insufficient memory for the terminating null of the string.
This commit is contained in:
parent
77aa055e8a
commit
20971f7034
@ -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
|
* dm_task_get_message_response() returns a 'const char *' but
|
||||||
* since fmemopen also permits "w" it expects a 'char *'.
|
* 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;
|
return_0;
|
||||||
|
|
||||||
/* begin region table */
|
/* 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
|
* dm_task_get_message_response() returns a 'const char *' but
|
||||||
* since fmemopen also permits "w" it expects a 'char *'.
|
* 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)
|
if (!stats_rows)
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user