kbx: Avoid undefined behavior.