buffer: special case empty string writes

Prior to 119354f we specifically handled passing a zero length string
to write on a buffer, restore that functionality.