summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/util.c b/src/util.c
index ffc5dc3..5361e70 100644
--- a/src/util.c
+++ b/src/util.c
@@ -18,6 +18,10 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
@@ -499,11 +503,11 @@ int prune_empty_directories(const char *path, const char *root) {
char rroot[PATH_MAX],
rpath[PATH_MAX];
- strncpy(rroot, root, PATH_MAX);
+ strncpy(rroot, root, PATH_MAX-1);
rroot[PATH_MAX-1] = 0;
normalize_path(rroot);
- strncpy(rpath, path, PATH_MAX);
+ strncpy(rpath, path, PATH_MAX-1);
rpath[PATH_MAX-1] = 0;
normalize_path(rpath);
@@ -545,7 +549,7 @@ int mkdir_p(const char *path, mode_t m) {
char *e, *b;
int quit = 0;
- strncpy(tmp, path, PATH_MAX);
+ strncpy(tmp, path, PATH_MAX-1);
tmp[PATH_MAX-1] = 0;
normalize_path(tmp);
@@ -582,7 +586,7 @@ int mkdir_p(const char *path, mode_t m) {
int makeprefixpath(const char *path, mode_t m) {
char tmp[PATH_MAX], *e;
- strncpy(tmp, path, PATH_MAX);
+ strncpy(tmp, path, PATH_MAX-1);
tmp[PATH_MAX-1] = 0;
normalize_path(tmp);