if 'length' is < 0, then 'buffer' is null-terminated' (does not contain '\0' or 'NULL' bytes')