multipathd: fix "show maps json" crash
authorBenjamin Marzinski <bmarzins@redhat.com>
Fri, 2 Jun 2017 03:09:12 +0000 (22:09 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 21 Jun 2017 10:08:58 +0000 (12:08 +0200)
commitba83d1093ceff99bceba7c78dd67e335b1bd2de6
tree31410b7dcb0fe5dee82d36018eeee594c1a66c1a
parent4b664c370b42c3d1b7502bbfd6a6dc1762876285
multipathd: fix "show maps json" crash

If there are no multipath devices, show_maps_json sets the maximum size
of the reply buffer to 0. Having a size of 0 causes the calls to calloc
and realloc to behave in ways that the code isn't designed to handle,
leading to a double-free crash. Instead, show_maps_json should just
use the INITIAL_REPLY_LEN if there are no multipath devices.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/cli_handlers.c