Fix error checking in append_string

Test: m -j
Change-Id: Ifa806d5037acb17f83cbf45712e9795d6f56152f
This commit is contained in:
Ruchir Rastogi 2019-12-18 13:43:05 -08:00
parent 27fa358d41
commit 3bbc240263

View file

@ -142,7 +142,7 @@ static void append_byte_array(struct stats_event* event, uint8_t* buf, size_t si
// Side-effect: modifies event->errors if buf is not properly null-terminated
static void append_string(struct stats_event* event, const char* buf) {
size_t size = strnlen(buf, MAX_EVENT_PAYLOAD);
if (event->errors) {
if (size == MAX_EVENT_PAYLOAD) {
event->errors |= ERROR_STRING_NOT_NULL_TERMINATED;
return;
}