From d346cd90602a422f0ca4408448b7d4445db38445 Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Sat, 7 Apr 2012 05:20:36 +0200 Subject: examples: Use snprintf() instead of sprintf() in dpfp and dpfp_threaded The OpenBSD C compiler generates a warning for every use of sprintf() and for a good reason. Reported in http://marc.info/?m=133376187514495 Reported-by: Xiaofan Chen --- examples/dpfp.c | 2 +- examples/dpfp_threaded.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/dpfp.c b/examples/dpfp.c index 7652407..55daff8 100644 --- a/examples/dpfp.c +++ b/examples/dpfp.c @@ -226,7 +226,7 @@ static int save_to_file(unsigned char *data) FILE *fd; char filename[64]; - sprintf(filename, "finger%d.pgm", img_idx++); + snprintf(filename, sizeof(filename), "finger%d.pgm", img_idx++); fd = fopen(filename, "w"); if (!fd) return -1; diff --git a/examples/dpfp_threaded.c b/examples/dpfp_threaded.c index a46d885..a0557c2 100644 --- a/examples/dpfp_threaded.c +++ b/examples/dpfp_threaded.c @@ -255,7 +255,7 @@ static int save_to_file(unsigned char *data) FILE *fd; char filename[64]; - sprintf(filename, "finger%d.pgm", img_idx++); + snprintf(filename, sizeof(filename), "finger%d.pgm", img_idx++); fd = fopen(filename, "w"); if (!fd) return -1; -- cgit v1.2.1