From 24920c9a08fb5b42884d4ddcda9a76c29255f1e6 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 6 Feb 2021 23:02:06 +0000 Subject: [PATCH] Fix possible loss of data in `mosquitto_pub -l` when sending multiple long lines. Closes #2078. Thanks to Ysincit. --- ChangeLog.txt | 4 ++++ client/pub_client.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ba115c0a65..3831823ed9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Clients: +- Fix possible loss of data in `mosquitto_pub -l` when sending multiple long + lines. Closes #2078. + 2.0.7 - 2021-02-04 ================== diff --git a/client/pub_client.c b/client/pub_client.c index 9153ebad25..8049de6e9f 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -275,7 +275,7 @@ int pub_stdin_line_loop(struct mosquitto *mosq) break; }else{ line_buf_len += 1024; - pos += 1023; + pos += read_len-1; read_len = 1024; buf2 = realloc(line_buf, (size_t )line_buf_len); if(!buf2){