1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

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>
This commit is contained in:
Andreas Schneider 2018-05-08 09:22:00 +02:00 committed by Andreas Schneider
parent 9b6dc8f504
commit 7cec343a89

View File

@ -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) {