~jpsamaroo/pahole

69fce762074a548372759298e347b1f8e7e40d7b — Arnaldo Carvalho de Melo 1 year, 9 months ago 22f9376
pahole: Use "%s" in a snprintf call

To address this clang 11 build error:

[ 86%] Building C object CMakeFiles/pahole.dir/pahole.c.o
/home/acme/git/pahole/pahole.c:1626:33: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                        snprintf(name, sizeof(name), enumerator__name(enumerator, cu_enumerator));
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/acme/git/pahole/pahole.c:1626:33: note: treat the string as an argument to avoid this
                        snprintf(name, sizeof(name), enumerator__name(enumerator, cu_enumerator));
                                                     ^
                                                     "%s",
1 error generated.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 files changed, 1 insertions(+), 1 deletions(-)

M pahole.c
M pahole.c => pahole.c +1 -1
@@ 1623,7 1623,7 @@ static struct tag *tag__real_type(struct tag *tag, struct cu **cup, void *instan
				return enumerator->type_enum.tag;
			}

			snprintf(name, sizeof(name), enumerator__name(enumerator, cu_enumerator));
			snprintf(name, sizeof(name), "%s", enumerator__name(enumerator, cu_enumerator));
			strlwr(name);

			struct tag *real_type = cu__find_type_by_name(*cup, name, false, NULL);