log: Remove undefined behaviour