Only treat null and undefined lengths as null-terminated strings