Fix crash bug in cmdline sanitization