buf.length 应该是length