I think you should use something like chomp here. I'm just not a fan of indiscriminate slicing, even though a null byte is assumed... and I don't like making assumptions.