The NULs are supposed to come tab-escaped, so there's no need to support
actual NUL characters. The previous code truncated at NULs, but could
have kept appending more data to the value. This could have produced
somewhat random results.
conn_error(conn, "close(client) failed: %m");
pl->client->fd = fd;
}
- str_append_n(pl->input, buf, ret);
+ str_append_data(pl->input, buf, ret);
}
len = str_len(pl->input);
instr = t_str_new(1024);
ret = fd_read(conn->fd, buf, sizeof(buf), &fd);
while (ret > 0) {
- str_append_n(instr, buf, ret);
+ str_append_data(instr, buf, ret);
if (buf[ret-1] == '\n' &&
strchr(str_c(instr), '\n')[1] != '\0') {
str_truncate(instr, str_len(instr)-1);