You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GCC and clang are able to detect if the format string modifiers are matching the given variables. As long as the standard c format modifiers are used, see #68 the printf and scanf type functions should be annotated with these attributes:
__attribute__ ((format (printf, 2, 3)));
The first argument is the position of the format string and the second of the var args parameter.
This is supported for printf, scanf, strftime or strfmon type functions by GCC and CLANG.
How should this be best implemented?
When I used scanf_s() with a wrong format modifier my code will compile without any warning, but I would like to get a warning about this to see the problems at compile time and not introduce potential security problems.
The text was updated successfully, but these errors were encountered:
I'll rather probe for it and add it to the generated safe_types.h
icc can do it also, who knows what other crazy cross compilers also.
The wprintf and wscanf format attributes are waiting to be implemented, patches do exist since 2008.
GCC and clang are able to detect if the format string modifiers are matching the given variables. As long as the standard c format modifiers are used, see #68 the printf and scanf type functions should be annotated with these attributes:
The first argument is the position of the format string and the second of the var args parameter.
This is supported for printf, scanf, strftime or strfmon type functions by GCC and CLANG.
How should this be best implemented?
When I used scanf_s() with a wrong format modifier my code will compile without any warning, but I would like to get a warning about this to see the problems at compile time and not introduce potential security problems.
The text was updated successfully, but these errors were encountered: