From 39b09776b60965ff0daaa36e15ee8b3739887661 Mon Sep 17 00:00:00 2001 From: Wahaj18 <48466561+Wahaj18@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:41:42 +0500 Subject: [PATCH] Leave room for the terminating NUL in rotctld replies rotctld_socket_rw() let recv() fill the whole buffer and then wrote the terminating NUL at buffout[size], one byte past the end of the 128-byte buffers used by get_pos(), set_pos() and rot_locked_cb() when the reply was 128 bytes or longer. Read at most sizeout - 1 bytes, as the rigctld helper in gtk-rig-ctrl.c already does. Fixes #435 --- src/gtk-rot-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk-rot-ctrl.c b/src/gtk-rot-ctrl.c index f3282317..bea0cfed 100644 --- a/src/gtk-rot-ctrl.c +++ b/src/gtk-rot-ctrl.c @@ -177,7 +177,7 @@ static gboolean rotctld_socket_rw(gint sock, gchar *buff, gchar *buffout, } /* try to read answer */ - size = recv(sock, buffout, sizeout, 0); + size = recv(sock, buffout, sizeout - 1, 0); if (size == -1) {