summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-08-29 10:24:23 +0100
committerVincent Sanders <vince@kyllikki.org>2018-08-29 10:24:23 +0100
commit912aa3774e2889070b28ecd94df11ac228666457 (patch)
tree0ce4551113a34300cbc98a6310c85990e50079e7 /utils
parent9142bab7363095e538d1f24bed6ae32a9b1d5820 (diff)
downloadnetsurf-912aa3774e2889070b28ecd94df11ac228666457.tar.gz
netsurf-912aa3774e2889070b28ecd94df11ac228666457.tar.bz2
remove use of strcpy
Diffstat (limited to 'utils')
-rw-r--r--utils/filepath.c2
-rw-r--r--utils/filepath.h14
2 files changed, 11 insertions, 5 deletions
diff --git a/utils/filepath.c b/utils/filepath.c
index ee5f107c9..9c1e7667b 100644
--- a/utils/filepath.c
+++ b/utils/filepath.c
@@ -165,7 +165,7 @@ filepath_sfinddef(char **respathv,
snprintf(t, PATH_MAX, "%s/%s", def, filename);
}
if (realpath(t, ret) == NULL) {
- strcpy(ret, t);
+ strncpy(ret, t, PATH_MAX);
}
}
diff --git a/utils/filepath.h b/utils/filepath.h
index ad077e2ce..784264b33 100644
--- a/utils/filepath.h
+++ b/utils/filepath.h
@@ -69,10 +69,10 @@ char *filepath_findfile(const char *format, ...);
* normalised file name of the first acessible file or NULL if no file
* can be found in any of the resource paths.
*
- * @param respathv The resource path vector to iterate.
- * @param filepath The buffer to place the result in.
- * @param filename The filename of the resource to search for.
- * @return A pointer to filepath if a target is found or NULL if not.
+ * \param respathv The resource path vector to iterate.
+ * \param filepath The buffer to place the result in.
+ * \param filename The filename of the resource to search for.
+ * \return A pointer to filepath if a target is found or NULL if not.
*/
char *filepath_sfind(char **respathv, char *filepath, const char *filename);
@@ -93,6 +93,12 @@ char *filepath_find(char **respathv, const char *filename);
* is used as an additional path element to search, if that still
* fails the returned path is set to the concatination of the default
* path and the filename.
+ *
+ * \param respathv The resource path vector to iterate.
+ * \param filepath The buffer to place the result in. Must have space for PATH_MAX bytes.
+ * \param filename The filename of the resource to search for.
+ * \param def The default path to use
+ * \return A pointer to filepath if a target is found or the default if not
*/
char *filepath_sfinddef(char **respathv, char *filepath, const char *filename,
const char *def);