That's what we do elsewhere, as it guarantees that we null-terminate the
error message (not that we will ever overflow the buffer in that case,
as the error message is definitely shorter than the error buffer size).
rlen = ntohs(header->rlen);
if (rlen < dag_record_size)
{
- strncpy(p->errbuf, "dag_read: record too small", PCAP_ERRBUF_SIZE);
+ pcap_strlcpy(p->errbuf, "dag_read: record too small",
+ PCAP_ERRBUF_SIZE);
return -1;
}
pd->dag_mem_bottom += rlen;