How do you call vsnprintf() safely?

后端 未结 3 661
借酒劲吻你
借酒劲吻你 2021-01-14 02:06

I\'m porting some very old (> 10y) C code to modern Linuxes. I\'m getting segmentation faults within a custom-written vsnprintf() wrapper (apparently its task is to detect d

3条回答
  •  既然无缘
    2021-01-14 02:38

    Unsure on yours, but my man page on variable argument lists says:

    COMPATIBILITY
    These macros are not compatible with the historic macros they replace. A backward compatible version can be found in the include file .

    As you said it is very old code, maybe the va_list received in this routine is not the va_list expected by vsnprintf. You should first try to extract all parameters with one header then the other to be sure (normally vsnprintf is stdarg.h compatible)

提交回复
热议问题