change interface from NUL-terminated to length