mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 07:12:08 +02:00
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:
7
src/at.c
7
src/at.c
@@ -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);
|
||||
|
Reference in New Issue
Block a user