From 9b748bdb2e34d1e3e11aaf8398af71e4a96d92b9 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Sat, 27 May 2023 14:58:07 -0500 Subject: [PATCH] Fix read_string_generic to only use expected_len when expected_len == 0 https://github.com/Hamlib/Hamlib/commit/00b6e0ecd72104d1c074e78ba3ddb87569ac1e19#commitcomment-115297173 --- src/iofunc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iofunc.c b/src/iofunc.c index e0d746cc6..25d5b9c33 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -1336,6 +1336,7 @@ static int read_string_generic(hamlib_port_t *p, memset(rxbuffer, 0, rxmax); short timeout_retries = p->timeout_retry; + if (expected_len == 0) expected_len = rxmax; while ( total_count < expected_len && total_count < rxmax - 1) // allow 1 byte for end-of-string { ssize_t rd_count = 0;