diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-09-26 16:12:18 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-09-26 16:12:18 +0200 |
| commit | 2ffd4e4f1af16b17a286ff354603a717f5d828a5 (patch) | |
| tree | 99e2d4a7e2fde8e3abb027eb687901440750ee00 /test/file_chooser.cxx | |
| parent | 53d9614adbb728fc4db983c9bb817c6eea870994 (diff) | |
Replace all calls to sprintf() by calls to snprintf().
Diffstat (limited to 'test/file_chooser.cxx')
| -rw-r--r-- | test/file_chooser.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx index b705f052e..a79ef2023 100644 --- a/test/file_chooser.cxx +++ b/test/file_chooser.cxx @@ -295,9 +295,9 @@ pdf_check(const char *name, // I - Name of file return 0; home = fl_getenv("HOME"); - sprintf(preview, "%s/.preview.ppm", home ? home : ""); + snprintf(preview, FL_PATH_MAX, "%s/.preview.ppm", home ? home : ""); - sprintf(command, + snprintf(command, sizeof(command), "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' " "-dFirstPage=1 -dLastPage=1 \'%s\' 2>/dev/null", preview, name); @@ -331,11 +331,11 @@ ps_check(const char *name, // I - Name of file return 0; home = fl_getenv("HOME"); - sprintf(preview, "%s/.preview.ppm", home ? home : ""); + snprintf(preview, FL_PATH_MAX, "%s/.preview.ppm", home ? home : ""); if (memcmp(header, "%!PS", 4) == 0) { // PS file has DSC comments; extract the first page... - sprintf(outname, "%s/.preview.ps", home ? home : ""); + snprintf(outname, FL_PATH_MAX, "%s/.preview.ps", home ? home : ""); if (strcmp(name, outname) != 0) { in = fl_fopen(name, "rb"); @@ -360,7 +360,7 @@ ps_check(const char *name, // I - Name of file outname[sizeof(outname) - 1] = '\0'; } - sprintf(command, + snprintf(command, sizeof(command), "gs -r100 -dFIXED -sDEVICE=ppmraw -dQUIET -dNOPAUSE -dBATCH " "-sstdout=\"%%stderr\" -sOUTPUTFILE=\'%s\' \'%s\' 2>/dev/null", preview, outname); |
