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

index 16ff692639a4b46c21e0339348ed8a0e95af87a5..51f79beffaffda489a473c51ab6a8848d41331cd 100644 (file)
@@ -771,16 +771,16 @@ char *DtPrinterIcon::GetPrinterLabel(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 *label = DtActionLabel(buf);
       if (label)
-         strcpy(buf, label);
+         snprintf(buf, sizeof(buf), "%s", label);
       else
-         strcpy(buf, printer);
+         snprintf(buf, sizeof(buf), "%s", printer);
     }
    else
-      strcpy(buf, printer);
+      snprintf(buf, sizeof(buf), "%s", printer);
    return buf;
 }