Protect printf-like calls against format errors
This commit is contained in:
parent
3fdbb95080
commit
d03fe10be8
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: MIT */
|
* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
#include "common.h"
|
#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, ...)
|
verr(const char *prefix, const char *func, const char *errstr, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -65,7 +65,7 @@ verr(const char *prefix, const char *func, const char *errstr, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void __attribute__((format(printf, 3, 4)))
|
||||||
vdie(const char *prefix, const char *func, const char *errstr, ...)
|
vdie(const char *prefix, const char *func, const char *errstr, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
void
|
void __attribute__((format(printf, 3, 4)))
|
||||||
chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
|
chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
memset(chan, 0, sizeof(struct chan));
|
memset(chan, 0, sizeof(struct chan));
|
||||||
|
@ -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 */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
@ -17,7 +17,7 @@ static const char **track_suffix[TRACK_TYPE_MAX] = {
|
|||||||
[TRACK_TYPE_TH] = th_suffix,
|
[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, ...)
|
track_init(struct track *track, struct bay *bay, enum track_type type, int mode, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
Loading…
Reference in New Issue
Block a user