eval/encode: Silence V595 error

This commit is contained in:
ZyX 2017-05-20 03:47:01 +03:00
parent 7f24736ebc
commit 1db29cb5e5

View File

@ -253,7 +253,9 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
char *const buf_end = buf + nbuf;
char *p = buf;
while (p < buf_end) {
assert(state->li_length == 0 || state->li->li_tv.vval.v_string != NULL);
for (size_t i = state->offset; i < state->li_length && p < buf_end; i++) {
assert(state->li->li_tv.vval.v_string != NULL);
const char ch = (char)state->li->li_tv.vval.v_string[state->offset++];
*p++ = (char)((char)ch == (char)NL ? (char)NUL : (char)ch);
}