dtsr/dtsrclean.c: Coverity CID 86876; dest buf too small
authorJon Trulson <jon@radscan.com>
Mon, 2 Apr 2018 22:50:24 +0000 (16:50 -0600)
committerJon Trulson <jon@radscan.com>
Mon, 2 Apr 2018 23:02:16 +0000 (17:02 -0600)
cde/programs/dtsr/dtsrclean.c

index 2bc3e40353fdbd14b7f4338ca7f1e65bbc27107b..b5ab2baef848b52ecde2fbd127783fddb9595254 100644 (file)
@@ -610,14 +610,14 @@ void            read_d2x (struct or_hwordrec * glob_word, long field)
 static void     write_d2x (struct or_hwordrec * glob_word, long field)
 {
     if (field == OR_SWORDKEY) {
-       strcpy (d21new.or_swordkey, glob_word->or_hwordkey);
+       snprintf(d21new.or_swordkey, 16, "%s", glob_word->or_hwordkey);
        d21new.or_swoffset =    htonl (glob_word->or_hwoffset);
        d21new.or_swfree =      htonl (glob_word->or_hwfree);
        d21new.or_swaddrs =     htonl (glob_word->or_hwaddrs);
        RECWRITE (PROGNAME "102", &d21new, 0);
     }
     else if (field == OR_LWORDKEY) {
-       strcpy (d22new.or_lwordkey, glob_word->or_hwordkey);
+       snprintf(d22new.or_lwordkey, 40, "%s", glob_word->or_hwordkey);
        d22new.or_lwoffset =    htonl (glob_word->or_hwoffset);
        d22new.or_lwfree =      htonl (glob_word->or_hwfree);
        d22new.or_lwaddrs =     htonl (glob_word->or_hwaddrs);