Skip to content

Commit bc3628a

Browse files
rayozziezfields
authored andcommitted
fix crc calculation in note-c
1 parent d8ad112 commit bc3628a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Blues Wireless Notecard
2-
version=1.4.3
2+
version=1.4.4
33
author=Blues Wireless
44
maintainer=Blues Wireless <[email protected]>
55
sentence=An easy to use Notecard Library for Arduino.

src/note-c/n_request.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,11 @@ NOTE_C_STATIC char *crcAdd(char *json, uint16_t seqno)
725725
/**************************************************************************/
726726
NOTE_C_STATIC bool crcError(char *json, uint16_t shouldBeSeqno)
727727
{
728+
// Strip off any crlf for crc calculation
728729
size_t jsonLen = strlen(json);
730+
while (jsonLen > 0 && json[jsonLen-1] <= ' ') {
731+
jsonLen--;
732+
}
729733
// Minimum valid JSON is "{}" (2 bytes) and must end with a closing "}".
730734
if (jsonLen < CRC_FIELD_LENGTH+2 || json[jsonLen-1] != '}') {
731735
return false;

0 commit comments

Comments
 (0)