fixed (hopefully) corruption of data
This commit is contained in:
parent
fe33bf622a
commit
c3fdacc8db
|
@ -210,9 +210,10 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
|
||||||
me = me->next;
|
me = me->next;
|
||||||
|
|
||||||
// Check if we already have this LABEL (same name AND same size)
|
// 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
|
// 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;
|
*flags |= TINFO_FLAGS_EXIST;
|
||||||
me->flags = *flags;
|
me->flags = *flags;
|
||||||
return ( me );
|
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 ?
|
// Do we have enought space to hold new value ?
|
||||||
if (strlen(me->value) >= lgvalue ) {
|
if (strlen(me->value) >= lgvalue ) {
|
||||||
// Copy it
|
// Copy it
|
||||||
strlcpy(me->value, value , lgvalue );
|
strlcpy(me->value, value , lgvalue + 1);
|
||||||
me->checksum = checksum ;
|
me->checksum = checksum ;
|
||||||
|
|
||||||
// That's all
|
// That's all
|
||||||
|
|
Loading…
Reference in New Issue