Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
897 stars 200 forks source link

The type for various variadic functions (_printf) are inaccurate in macOS type libraries #5844

Open xusheng6 opened 1 month ago

xusheng6 commented 1 month ago

bv.type_libraries [<typelib '/usr/lib/libSystem.B.dylib.mac-aarch64.1292.100.5':aarch64>] lib = bv.type_libraries[0] bv.import_library_object('_printf', lib) <type: immutable:FunctionTypeClass 'int32_t(char const*)'>

It should be int32_t _printf(char const*, ...). This also affects functions like _scanf, vsprintf, snprintf, and potentially other variadic functions as well.

This does not affect Linux type libraries -- they are correct

HarDToBelieve commented 2 weeks ago

Confirmed, not only for MacOS type libraries, but also in all ARM type libraries

0xricksanchez commented 2 weeks ago

Seems Rel: #5828?

psifertex commented 2 weeks ago

Don't think it's related. Lack of type libraries is totally independent from heuristic analysis being off.