MKRGSM Major Bug

MKR GSM 1400 while using MKRGSM.h could be easily crashed by anyone by simply sending SMS messages like.

The problem lies in Modem.cpp
int responseResultIndex = _buffer.lastIndexOf("OK\r\n");
if (responseResultIndex != -1) {
_ready = 1;
.. same problem with indexing words ERROR and NO CARRIER

AT command notify a new message- and code will consider OK in the message as AT command response before receiving full message from the buffer.
+CMGL: 18,"REC UNREAD","+XXXXXXXX",,"19/11/25,19:59:43+08"

// CRASH...

Correct would be wait for the AT response OK like below
+CMGL: 18,"REC UNREAD","+XXXXXXXX",,"19/11/25,19:59:43+08"


I agree. See arduino - SIM900 AT Commands response parsing - Stack Overflow

Pull request added Handle SMS responses by janakelarsson · Pull Request #104 · arduino-libraries/MKRGSM · GitHub.

I've been using OK as a response to sms messages sent by my code for months now and never had a single issue with the code crashing because of the OK message. Is this a theoretical argument or have you tested it and have experienced crashes in your code?