device-mapper-multipath/0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch

30 lines
913 B
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 24 Jul 2024 16:38:52 -0400
Subject: [PATCH] multipathd: set reply length to zero for NULL replies
The multipathd cli handlers add one to the reply length to account for
NULL byte, but if the reply is NULL, there is no NULL by to account for,
and len should be 0, so that mutipathd replies to clients with a
default reply.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index eb2e8c1d..03ad0d64 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -496,6 +496,9 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout )
r = h->fn(cmdvec, reply, len, data);
free_keys(cmdvec);
+ if (*reply == NULL)
+ *len = 0;
+
return r;
}