git.samba.org
/
gd
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b6dc8f
)
lib:util: Fix string check in mkdir_p()
author
Andreas Schneider
<asn@samba.org>
Tue, 8 May 2018 07:22:00 +0000
(09:22 +0200)
committer
Andreas Schneider
<asn@cryptomilk.org>
Thu, 17 May 2018 15:30:09 +0000
(17:30 +0200)
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>
lib/util/mkdir_p.c
patch
|
blob
|
history
diff --git
a/lib/util/mkdir_p.c
b/lib/util/mkdir_p.c
index 290a1f395206436269901477ac8840a25886f32d..87a3f797618442403a106bf7ee9906056556007f 100644
(file)
--- 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) {