mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Replace va_list fmt() overload with vfmt()
Using an overload that takes a va_list argument potentially causes accidental misuse on platforms (e.g. 32-bit) where va_list is implemented as a type that may collide with commonly-used argument types. For example: char* c = copy_string("hi"); fmt("%s", (const char*)c); fmt("%s", c); The first fmt() call correctly goes through fmt(const char*, ...) first, but the second mistakenly goes through fmt(const char*, va_list) first because variadic function overloads have lower priority during overload resolution and va_list on a 32-bit system happens to be defined as a pointer type that can match with "char*" but not "const char*".
This commit is contained in:
parent
8e353aafe5
commit
8fed26824b
5 changed files with 11 additions and 5 deletions
|
@ -625,7 +625,7 @@ void Manager::Error(const char* format, ...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
auto msg = fmt(format, args);
|
||||
auto msg = vfmt(format, args);
|
||||
va_end(args);
|
||||
|
||||
if ( script_scope )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue