libubox: add format string checking to ulog()
This offers an increased level of security, as the arguments will be checked for validity against the format string at compile time. The format attribute is supported by both GCC and Clang, so there shouldn't be any portability issues. Signed-off-by: Kristupas Savickas <savickas.kristupas@gmail.com>
This commit is contained in:
parent
eeef7b50a0
commit
9dd2dcff70
1 changed files with 2 additions and 1 deletions
3
ulog.h
3
ulog.h
|
@ -32,7 +32,8 @@ void ulog_close(void);
|
||||||
|
|
||||||
void ulog_threshold(int threshold);
|
void ulog_threshold(int threshold);
|
||||||
|
|
||||||
void ulog(int priority, const char *fmt, ...);
|
void ulog(int priority, const char *fmt, ...)
|
||||||
|
__attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
#define ULOG_INFO(fmt, ...) ulog(LOG_INFO, fmt, ## __VA_ARGS__)
|
#define ULOG_INFO(fmt, ...) ulog(LOG_INFO, fmt, ## __VA_ARGS__)
|
||||||
#define ULOG_NOTE(fmt, ...) ulog(LOG_NOTICE, fmt, ## __VA_ARGS__)
|
#define ULOG_NOTE(fmt, ...) ulog(LOG_NOTICE, fmt, ## __VA_ARGS__)
|
||||||
|
|
Loading…
Reference in a new issue