[SLOF] [PATCH] libnet: Make the code compilable with -Wformat-security
Alexey Kardashevskiy
aik at ozlabs.ru
Fri Jul 7 16:45:01 AEST 2017
On 06/07/17 23:35, Thomas Huth wrote:
> When compiling the libnet code with the -Wformat-security compiler
> flag, there is a warning in tftp.c that printf is used without
> format argument. It's not a real problem here, but let's make
> the code ready for this compiler flag anyway and add a proper
> format string here, too.
>
Thanks, applied.
> Signed-off-by: Thomas Huth <thuth at redhat.com>
> ---
> lib/libnet/tftp.c | 2 +-
> make.rules | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/libnet/tftp.c b/lib/libnet/tftp.c
> index ab63578..108092b 100644
> --- a/lib/libnet/tftp.c
> +++ b/lib/libnet/tftp.c
> @@ -266,7 +266,7 @@ static void print_progress(int urgent, int received_bytes)
> sprintf(buffer, "%d KBytes", (progress_last_bytes >> 10));
> for(ptr = buffer; *ptr != 0; ++ptr)
> *ptr = '\b';
> - printf(buffer);
> + printf("%s", buffer);
> }
> printf("%d KBytes", (received_bytes >> 10));
> i = 1;
> diff --git a/make.rules b/make.rules
> index cbc6353..3067314 100644
> --- a/make.rules
> +++ b/make.rules
> @@ -72,7 +72,7 @@ AR ?= $(CROSS)ar
> RANLIB ?= $(CROSS)ranlib
> CPP ?= $(CROSS)cpp
>
> -WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes
> +WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wformat-security
> CFLAGS ?= -g -O2 -fno-builtin -ffreestanding -nostdinc -msoft-float -fno-strict-aliasing \
> -mno-altivec -mabi=no-altivec -fno-stack-protector $(WARNFLAGS)
>
>
--
Alexey
More information about the SLOF
mailing list