From 02da0b0ae947f30480b1246de22e865491e479f0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 12 Feb 2014 13:26:02 +0100
Subject: [PATCH] PATCHSET12: s3-winbind: Use strlcpy to avoid log entry.

The full_name from Windows can be longer than 255 chars which results in
a warning on log level 0 that we have a string overflow. This will avoid
the warning. However we should fix this sooner or later on the protocol
level to have no limit.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Conflicts:
	source3/winbindd/wb_fill_pwent.c
---
 source3/winbindd/wb_fill_pwent.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index 9634317..9d42b31 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -141,8 +141,13 @@ static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq)
 				     true);
 	}
 
-	fstrcpy(state->pw->pw_name, output_username);
-	fstrcpy(state->pw->pw_gecos, state->info->full_name);
+	strlcpy(state->pw->pw_name,
+		output_username,
+		sizeof(state->pw->pw_name));
+	/* FIXME The full_name can be longer than 255 chars */
+	strlcpy(state->pw->pw_gecos,
+		state->info->full_name ? state->info->full_name : "",
+		sizeof(state->pw->pw_gecos));
 
 	/* Home directory and shell */
 	ok = fillup_pw_field(lp_template_homedir(),
-- 
1.9.3

