dtprintinfo: Coverity 88650
authorPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 00:49:50 +0000 (01:49 +0100)
committerPeter Howkins <flibble@users.sf.net>
Wed, 4 Jul 2018 00:49:50 +0000 (01:49 +0100)
cde/programs/dtprintinfo/UI/DtPrinterIcon.C

index 385f1d31faa147a092e1c7a9d07c64d6bfcb5788..16ff692639a4b46c21e0339348ed8a0e95af87a5 100644 (file)
@@ -752,17 +752,17 @@ char *DtPrinterIcon::GetPrinterIcon(const char *printer,
 {
    static char buf[200];
 
-   sprintf(buf, "%s_Print", printer);
+   snprintf(buf, sizeof(buf), "%s_Print", printer);
    if (_app_mode != INITIALIZE_PRINTERS && DtActionExists(buf))
     {
       char *iconfile = DtActionIcon(buf);
       if (iconfile)
-         strcpy(buf, iconfile);
+         snprintf(buf, sizeof(buf), "%s", iconfile);
       else
-         strcpy(buf, PRINTER_ICON_FILE);
+         snprintf(buf, sizeof(buf), "%s", PRINTER_ICON_FILE);
     }
    else
-      strcpy(buf, PRINTER_ICON_FILE);
+      snprintf(buf, sizeof(buf), "%s", PRINTER_ICON_FILE);
    return buf;
 }