Protect printf-like calls against format errors

This commit is contained in:
Rodrigo Arias 2024-06-21 14:09:41 +02:00
parent 3fdbb95080
commit d03fe10be8
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: MIT */
#include "common.h"
@ -56,7 +56,7 @@ vaerr(const char *prefix, const char *func, const char *errstr, va_list ap)
}
}
void
void __attribute__((format(printf, 3, 4)))
verr(const char *prefix, const char *func, const char *errstr, ...)
{
va_list ap;
@ -65,7 +65,7 @@ verr(const char *prefix, const char *func, const char *errstr, ...)
va_end(ap);
}
void
void __attribute__((format(printf, 3, 4)))
vdie(const char *prefix, const char *func, const char *errstr, ...)
{
va_list ap;

View File

@ -7,7 +7,7 @@
#include <string.h>
#include "common.h"
void
void __attribute__((format(printf, 3, 4)))
chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
{
memset(chan, 0, sizeof(struct chan));

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "track.h"
@ -17,7 +17,7 @@ static const char **track_suffix[TRACK_TYPE_MAX] = {
[TRACK_TYPE_TH] = th_suffix,
};
int
int __attribute__((format(printf, 5, 6)))
track_init(struct track *track, struct bay *bay, enum track_type type, int mode, const char *fmt, ...)
{
va_list ap;