Need more truth-checks

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-02-18 22:20:07 -05:00
parent 089077fdb7
commit 62516d26a3
9 changed files with 22 additions and 18 deletions

View File

@@ -268,10 +268,11 @@ class TinyGsmModem {
}
inline int16_t streamGetIntBefore(char lastChar) {
char buf[6];
char buf[7];
size_t bytesRead = thisModem().stream.readBytesUntil(
lastChar, buf, static_cast<size_t>(6));
if (bytesRead) {
lastChar, buf, static_cast<size_t>(7));
// if we read 7 or more bytes, it's an overflow
if (bytesRead && bytesRead < 7) {
buf[bytesRead] = '\0';
int16_t res = atoi(buf);
return res;