make prepend_name() work correctly when called with negative *buflen