do not modify the passed-in buffer