devip: fix arpread, dont return partial entries

This commit is contained in:
cinap_lenrek 2018-11-28 12:41:18 +01:00
parent 22b28520cd
commit 099da8cb82

View file

@ -460,16 +460,17 @@ arpread(Arp *arp, char *s, ulong offset, int len)
qunlock(arp);
runlock(ifc);
n = snprint(p, len, "%-6.6s %-4.4s %-40.40I %-16.16s %I\n",
n = snprint(up->genbuf, sizeof up->genbuf,
"%-6.6s %-4.4s %-40.40I %-16.16s %I\n",
mname, state, ip, mac, ia);
if(o < 0) {
if(n > -o)
memmove(p, p-o, n+o);
o += n;
} else {
len -= n;
p += n;
}
o += n;
if(o <= 0)
continue;
if(n > len)
break;
memmove(p, up->genbuf, n);
len -= n;
p += n;
}
return p - s;