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/clipboard.cxx | |
| parent | 53d9614adbb728fc4db983c9bb817c6eea870994 (diff) | |
Replace all calls to sprintf() by calls to snprintf().
Diffstat (limited to 'test/clipboard.cxx')
| -rw-r--r-- | test/clipboard.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/clipboard.cxx b/test/clipboard.cxx index ae517b988..3688d01cb 100644 --- a/test/clipboard.cxx +++ b/test/clipboard.cxx @@ -95,7 +95,7 @@ public: if (!cl_img) return 1; char title[300]; - sprintf(title, "%dx%d", cl_img->w(), cl_img->h()); // display the image original size + snprintf(title, 300, "%dx%d", cl_img->w(), cl_img->h()); // display the image original size // optional: display extra technical info about clipboard content @@ -105,20 +105,20 @@ public: char *p = title + strlen(title); int format = EnumClipboardFormats(0); if (format && format < CF_MAX) { - sprintf(p, " %d", format); + snprintf(p, sizeof(title) - strlen(title), " %d", format); p += strlen(p); } while (format) { format = EnumClipboardFormats(format); if (format && format < CF_MAX) { - sprintf(p, " %d", format); + snprintf(p, sizeof(title) - strlen(title), " %d", format); p += strlen(p); } } HANDLE h; if ((h = GetClipboardData(CF_DIB))) { LPBITMAPINFO lpBI = (LPBITMAPINFO)GlobalLock(h); - sprintf(p, " biBitCount=%d biCompression=%d biClrUsed=%d", + snprintf(p, sizeof(title) - strlen(title), " biBitCount=%d biCompression=%d biClrUsed=%d", lpBI->bmiHeader.biBitCount, (int)lpBI->bmiHeader.biCompression, (int)lpBI->bmiHeader.biClrUsed); |
