diff options
author | Peter Stuge <peter@stuge.se> | 2012-04-07 05:20:36 +0200 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-04-09 22:30:25 +0100 |
commit | d346cd90602a422f0ca4408448b7d4445db38445 (patch) | |
tree | f5e3315ea2b3b5c4538f92ab06b74869ca1ee370 | |
parent | 5b7d1c57f8dea7d6090d7478e4f39075c17decdb (diff) | |
download | libusbx-d346cd90602a422f0ca4408448b7d4445db38445.tar.gz |
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 <xiaofanc@gmail.com>
-rw-r--r-- | examples/dpfp.c | 2 | ||||
-rw-r--r-- | 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; |