cksum is computed incorrectly

The previous code read off the end of *buf, and also produced incorrect TCP checksums, when nbytes was odd.