pktgen: fix out-of-bounds access in pgctrl_write()