libDtSearch: Coverity 86698
authorPeter Howkins <flibble@users.sf.net>
Mon, 2 Jul 2018 21:48:20 +0000 (22:48 +0100)
committerPeter Howkins <flibble@users.sf.net>
Mon, 2 Jul 2018 21:48:20 +0000 (22:48 +0100)
cde/lib/DtSearch/raima/pathfcns.c

index 18c5943b478f8a43c75108bf4d1bd6dc619e4d55..75a2dd780891125d41ff19a1f4b8359a062f3dcb 100644 (file)
@@ -294,7 +294,7 @@ char *path_str              /* Path to remove filename from */
    /* There is only a filename if string does not contain a DIRCHAR or
       ':' which separates drive spec from path. */
    if (path_str == NULL) return (NULL);
-   strcpy(dirpath,path_str);           /* Copy into output string */
+   snprintf(dirpath, sizeof(dirpath), "%s", path_str); /* Copy into output string */
    if ((path_str = strrchr(dirpath,DIRCHAR)) == NULL)
       if ((path_str = strrchr(dirpath,':')) == NULL) return (NULL);
    path_str[1] = '\0';                 /* Truncate string */