我们对这行代码有一个 Coverity 错误:
snprintf( tempStr, size, testStrings[testID], A2DtoV(testResults[testID].value),
A2DtoV(testResults[testID].min),A2DtoV(testResults[testID].max));
错误说:
non_const_printf_format_string: "format string is not a string literal,
potential security vulnerability if user controlled"
我将 testStrings 更改为 const,但这并没有做任何事情:
static const char *testStrings[] = {"1", ... etc};
关于这个错误的真正含义有什么想法吗?