From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Wilck Subject: [PATCH v3 09/10] multipathd: fix buffer size in cli_getprkey() Date: Sun, 24 Jun 2018 21:09:43 +0200 Message-ID: <20180624190944.27158-10-mwilck@suse.com> References: <20180624190944.27158-1-mwilck@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180624190944.27158-1-mwilck@suse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Christophe Varoqui , Bart Van Assche , Benjamin Marzinski Cc: dm-devel@redhat.com, Martin Wilck List-Id: dm-devel.ids gcc 8.1 warned about this. Signed-off-by: Martin Wilck --- multipathd/cli_handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 47830e1c..5682b5c2 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -1449,7 +1449,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data) if (!mpp) return 1; - *reply = malloc(20); + *reply = malloc(26); if (!get_be64(mpp->reservation_key)) { sprintf(*reply, "none\n"); @@ -1458,7 +1458,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data) } if (mpp->sa_flags & MPATH_F_APTPL_MASK) flagstr = ":aptpl"; - snprintf(*reply, 20, "0x%" PRIx64 "%s\n", + snprintf(*reply, 26, "0x%" PRIx64 "%s\n", get_be64(mpp->reservation_key), flagstr); (*reply)[19] = '\0'; *len = strlen(*reply) + 1; -- 2.17.1