Fix read_string_generic to only use expected_len when expected_len == 0

00b6e0ecd7 (commitcomment-115297173)
pull/1330/head
Mike Black W9MDB 2023-05-27 14:58:07 -05:00
rodzic 34f20cc970
commit 9b748bdb2e
1 zmienionych plików z 1 dodań i 0 usunięć

Wyświetl plik

@ -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;