1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

Use av_printf_format to check the usage of printf style functions

This helps catching cases where the format string doesn't
match what is passed in, or injection bugs where user data
is passed in as format string.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2011-06-17 10:31:11 +03:00
parent 67e9ae14d9
commit 9abbe8cc13
6 changed files with 9 additions and 19 deletions

View File

@@ -22,6 +22,7 @@
#define AVUTIL_AVSTRING_H
#include <stddef.h>
#include "attributes.h"
/**
* Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
@@ -107,7 +108,7 @@ size_t av_strlcat(char *dst, const char *src, size_t size);
* @return the length of the string that would have been generated
* if enough space had been available
*/
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...);
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
/**
* Convert a number to a av_malloced string.

View File

@@ -23,6 +23,7 @@
#include <stdarg.h>
#include "avutil.h"
#include "attributes.h"
/**
* Describe the class of an AVClass context structure. That is an
@@ -129,11 +130,7 @@ typedef struct {
* subsequent arguments are converted to output.
* @see av_vlog
*/
#ifdef __GNUC__
void av_log(void *avcl, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
#else
void av_log(void *avcl, int level, const char *fmt, ...);
#endif
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
void av_vlog(void *avcl, int level, const char *fmt, va_list);
int av_log_get_level(void);