Skip to content

Commit 334022f

Browse files
authored
Fix buffer corner case (#85)
* remove note-c before re-add * Squashed 'src/note-c/' content from commit 08d493b git-subtree-dir: src/note-c git-subtree-split: 08d493b5214480a9aabb93913d7e8a18dec4243d * bump library version
1 parent 9f8fd06 commit 334022f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Blues Wireless Notecard
2-
version=1.3.14
2+
version=1.3.15
33
author=Blues Wireless
44
maintainer=Blues Wireless <[email protected]>
55
sentence=An easy to use Notecard Library for Arduino.

src/note-c/n_i2c.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ const char *i2cNoteTransaction(char *json, char **jsonResponse)
4545

4646
// Append newline to the transaction
4747
int jsonLen = strlen(json);
48-
uint8_t *transmitBuf = (uint8_t *) _Malloc(jsonLen+c_newline_len);
48+
uint8_t *transmitBuf = (uint8_t *) _Malloc(jsonLen+1);
4949
if (transmitBuf == NULL) {
5050
return ERRSTR("insufficient memory",c_mem);
5151
}
5252
memcpy(transmitBuf, json, jsonLen);
53-
memcpy(&transmitBuf[jsonLen], c_newline, c_newline_len);
54-
jsonLen += c_newline_len;
53+
transmitBuf[jsonLen++] = '\n';
5554

5655
// Transmit the request in chunks, but also in segments so as not to overwhelm the notecard's interrupt buffers
5756
const char *estr;

0 commit comments

Comments
 (0)