[minicoredumper] [PATCH 3/6] Fix format string warning

Simon Marchi simon.marchi at ericsson.com
Tue Oct 13 23:56:21 CEST 2015


This fixes the following warning in two locations:

corestripper.c: In function ‘print_fmt_token’:
corestripper.c:1928:3: error: format not a string literal and no format arguments [-Werror=format-security]
   ret = asprintf(&d_str, token);
   ^

Signed-off-by: Simon Marchi <simon.marchi at ericsson.com>
---
 src/libminicoredumper/mcd.c       | 2 +-
 src/minicoredumper/corestripper.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libminicoredumper/mcd.c b/src/libminicoredumper/mcd.c
index 1137373..367664f 100644
--- a/src/libminicoredumper/mcd.c
+++ b/src/libminicoredumper/mcd.c
@@ -96,7 +96,7 @@ static int print_fmt_token(FILE *ft, struct mcd_dump_data *dd, int fmt_offset,
 	case (PA_DOUBLE | PA_FLAG_LONG_DOUBLE):
 		ASPRINTF_CASE(long double *);
 	default:
-		ret = asprintf(&d_str, token);
+		ret = asprintf(&d_str, "%s", token);
 		break;
 	}
 
diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c
index 275eb31..d68469b 100644
--- a/src/minicoredumper/corestripper.c
+++ b/src/minicoredumper/corestripper.c
@@ -1929,7 +1929,7 @@ static int print_fmt_token(FILE *ft, struct dump_info *di,
 	case (PA_DOUBLE | PA_FLAG_LONG_DOUBLE):
 		ASPRINTF_CASE(long double *);
 	default:
-		ret = asprintf(&d_str, token);
+		ret = asprintf(&d_str, "%s", token);
 		break;
 	}
 
-- 
2.5.1





More information about the minicoredumper mailing list