From c3fdacc8dbccbbdea94f322f844d580db4271fe7 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 13 Jun 2020 01:38:00 +0200 Subject: [PATCH] fixed (hopefully) corruption of data --- src/LibTeleinfo.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/LibTeleinfo.cpp b/src/LibTeleinfo.cpp index 0311146..146153b 100644 --- a/src/LibTeleinfo.cpp +++ b/src/LibTeleinfo.cpp @@ -210,9 +210,10 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t me = me->next; // Check if we already have this LABEL (same name AND same size) - if (lgname==strlen(me->name) && strncmp(me->name, name, lgname)==0) { + if (lgname==strlen(me->name) && strcmp(me->name, name )==0) { + // Already got also this value return US - if (lgvalue==strlen(me->value) && strncmp(me->value, value, lgvalue) == 0) { + if (lgvalue==strlen(me->value) && strcmp(me->value, value) == 0) { *flags |= TINFO_FLAGS_EXIST; me->flags = *flags; return ( me ); @@ -223,7 +224,7 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t // Do we have enought space to hold new value ? if (strlen(me->value) >= lgvalue ) { // Copy it - strlcpy(me->value, value , lgvalue ); + strlcpy(me->value, value , lgvalue + 1); me->checksum = checksum ; // That's all