complain when nbytes > buflen to fix possible buffer overflow (closes #20246)