Skip to contentSkip to conversation

multipathd: fix read past end of of buffer in sending reply

PATCH In review Benjamin Marzinski 2 participants 2 messages Sep 8, 2022 – Sep 9, 2022 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 multipathd: fix read past end of of buffer in sending reply

Reduce the send() length for the uxlsnr reply, by the number of bytes already sent

---
 multipathd/uxlsnr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
multipathd/uxlsnr.c +1 -1
index 23cb123d..238744b7 100644
@@ -541,7 +541,7 @@ static int client_state_machine(struct client *c, struct vectors *vecs,
 		if (c->len < c->cmd_len) {
 			const char *buf = get_strbuf_str(&c->reply);
 
-			n = send(c->fd, buf + c->len, c->cmd_len, MSG_NOSIGNAL);
+			n = send(c->fd, buf + c->len, c->cmd_len - c->len, MSG_NOSIGNAL);
 			if (n == -1) {
 				if (!(errno == EAGAIN || errno == EINTR))
 					c->error = -ECONNRESET;
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Benjamin Marzinski

Reduce the send() length for the uxlsnr reply, by the number of bytes already sent

Quoted 16 lines

---
 multipathd/uxlsnr.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
multipathd/uxlsnr.c +0 -0
index 23cb123d..238744b7 100644
@@ -541,7 +541,7 @@ static int client_state_machine(struct client *c,
 struct vectors *vecs,
                 if (c->len < c->cmd_len) {
                         const char *buf = get_strbuf_str(&c->reply);


-                       n = send(c->fd, buf + c->len, c->cmd_len, MSG_NOSIGNAL);
+                       n = send(c->fd, buf + c->len, c->cmd_len - c-

Quoted 5 lines
Quoted 1 line

len, MSG_NOSIGNAL);

                        if (n == -1) {
                                if (!(errno == EAGAIN || errno == EINTR))
                                        c->error = -ECONNRESET;

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel