Skip to content

Commit

Permalink
Updating the position of the null terminator in the case for the stri…
Browse files Browse the repository at this point in the history
…ng data. In the existing code, the terminator is actually overwrites the last character when the value buffer length is exactly the size of the string data + 1.
  • Loading branch information
exharrison committed Aug 28, 2019
1 parent ef05709 commit 6c56d9c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/avpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,7 @@ int rc_avpair_tostr (rc_handle const *rh, VALUE_PAIR *pair, char *name, int ln,
}
ptr++;
}
if (lv > 0)
value[pos++] = 0;
else
value[pos-1] = 0;
value[pos] = 0;
break;

case PW_TYPE_INTEGER:
Expand Down

0 comments on commit 6c56d9c

Please sign in to comment.