Merge branch 'at-overflow' into 'master'

at: break before overflow when receiving messages

See merge request mobian1/devices/eg25-manager!40
This commit is contained in:
Arnaud Ferraris
2021-11-10 10:50:58 +00:00

View File

@@ -245,7 +245,14 @@ static gboolean modem_response(gint fd,
*/
do {
ret = read(fd, tmp, sizeof(tmp));
if (ret > 0) {
/* If we're going to overflow truncate the data we read to fit */
if (pos + ret >= sizeof(response)) {
g_critical("AT response buffer full, truncating");
ret = sizeof(response) - (pos + 1);
}
memcpy(&response[pos], tmp, ret);
pos += ret;
usleep(10000);