buffer: Fix incorrect Buffer.compare behavior

Fixes #7551