Clearly ip[32] is wrong, but it's less clear that buf[32] was wrong without further reading.
Attach a file by drag & drop or click to upload