2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 22:35:10 +00:00

Give every printf-like function restrict qualifiers

The format value has to be a string literal, every time.

Otherwise, you are not using these functions correctly. To reinforce this fact, I putrestrict over every non-contrib example of this I could find.
This commit is contained in:
Rose
2023-07-07 13:52:45 -04:00
parent 92860c717d
commit 5d758264ab
48 changed files with 143 additions and 143 deletions

View File

@@ -58,7 +58,7 @@ struct log_details {
#define SLOG_AUDIT 0x40 /* send message to audit as well */
#define SLOG_PARSE_ERROR 0x80 /* format as a parse error */
typedef bool (*sudoers_logger_t)(const char *file, int line, int column, const char *fmt, va_list args);
typedef bool (*sudoers_logger_t)(const char *file, int line, int column, const char * restrict fmt, va_list args);
/* XXX - needed for auditing */
extern int NewArgc;
@@ -73,8 +73,8 @@ struct log_details;
bool sudoers_warn_setlocale(bool restore, int *cookie);
bool sudoers_setlocale(int locale_type, int *prev_locale);
int sudoers_getlocale(void);
int audit_failure(char *const argv[], char const *const fmt, ...) sudo_printflike(2, 3);
int vaudit_failure(char *const argv[], char const *const fmt, va_list ap) sudo_printflike(2, 0);
int audit_failure(char *const argv[], char const * restrict const fmt, ...) sudo_printflike(2, 3);
int vaudit_failure(char *const argv[], char const * restrict const fmt, va_list ap) sudo_printflike(2, 0);
bool log_allowed(struct eventlog *evlog);
bool log_exit_status(int exit_status);
bool log_auth_failure(int status, unsigned int tries);
@@ -82,15 +82,15 @@ bool log_denial(int status, bool inform_user);
bool log_failure(int status, int flags);
bool log_server_alert(struct eventlog *evlog, struct timespec *now, const char *message, const char *errstr);
bool log_server_reject(struct eventlog *evlog, const char *message);
bool log_warning(int flags, const char *fmt, ...) sudo_printflike(2, 3);
bool log_warningx(int flags, const char *fmt, ...) sudo_printflike(2, 3);
bool gai_log_warning(int flags, int errnum, const char *fmt, ...) sudo_printflike(3, 4);
bool log_warning(int flags, const char * restrict fmt, ...) sudo_printflike(2, 3);
bool log_warningx(int flags, const char * restrict fmt, ...) sudo_printflike(2, 3);
bool gai_log_warning(int flags, int errnum, const char * restrict fmt, ...) sudo_printflike(3, 4);
bool sudoers_initlocale(const char *ulocale, const char *slocale);
bool sudoers_locale_callback(const char *file, int line, int column, const union sudo_defs_val *sd_un, int op);
void sudoers_to_eventlog(struct eventlog *evlog, const char *cmnd, char * const argv[], char *const envp[], const char *uuid_str);
void init_eventlog_config(void);
bool init_log_details(struct log_details *details, struct eventlog *evlog);
bool log_parse_error(const char *file, int line, int column, const char *fmt, va_list ap) sudo_printf0like(4, 0);
bool log_parse_error(const char *file, int line, int column, const char * restrict fmt, va_list ap) sudo_printf0like(4, 0);
bool mail_parse_errors(void);
#endif /* SUDOERS_LOGGING_H */