“libtypec” is aimed to provide a generic interface abstracting all platform complexity for user space to develop tools for efficient USB-C port management. The library can also enable development of diagnostic and debug tools to debug system issues around USB-C/USB PD topology.
function get_opr_mode() is opening a file and not checking for a NULL fp on file open failure:
This will end up with NULL pointer dereferencing (and SIGSEGV faults).
Same for function get_cable_plug_type(), get_cable_type() and get_cable_mode_support()