diff options
author | Andreas Schneider <asn@samba.org> | 2018-05-08 09:22:00 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-06-20 09:22:24 +0200 |
commit | c16e479f49f5bf010f61a923435ca16393747340 (patch) | |
tree | 004c2988f3c8088aba1a17688e10e31432b302f3 /lib | |
parent | 3e42a24ce882a90b3a5d567c47870f53d8e5f265 (diff) | |
download | samba-c16e479f49f5bf010f61a923435ca16393747340.tar.gz |
lib:util: Fix string check in mkdir_p()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 7cec343a89a0862c09f5ddd4707eb442157a4af2)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/mkdir_p.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/util/mkdir_p.c b/lib/util/mkdir_p.c index 290a1f39520..87a3f797618 100644 --- a/lib/util/mkdir_p.c +++ b/lib/util/mkdir_p.c @@ -49,11 +49,11 @@ int mkdir_p(const char *dir, int mode) /* Create ancestors */ len = strlen(dir); - if (len >= PATH_MAX) { + ret = snprintf(t, sizeof(t), "%s", dir); + if (ret != len) { errno = ENAMETOOLONG; return -1; } - strncpy(t, dir, len+1); ret = mkdir_p(dirname(t), mode); if (ret != 0) { |