Bug 1113005 - Copy only the necessary number of bytes from the source buffer; r=froydnj