1 From 02da0b0ae947f30480b1246de22e865491e479f0 Mon Sep 17 00:00:00 2001
2 From: Andreas Schneider <asn@samba.org>
3 Date: Wed, 12 Feb 2014 13:26:02 +0100
4 Subject: [PATCH] PATCHSET12: s3-winbind: Use strlcpy to avoid log entry.
6 The full_name from Windows can be longer than 255 chars which results in
7 a warning on log level 0 that we have a string overflow. This will avoid
8 the warning. However we should fix this sooner or later on the protocol
9 level to have no limit.
11 Signed-off-by: Andreas Schneider <asn@samba.org>
12 Reviewed-by: Volker Lendecke <vl@samba.org>
15 source3/winbindd/wb_fill_pwent.c
17 source3/winbindd/wb_fill_pwent.c | 9 +++++++--
18 1 file changed, 7 insertions(+), 2 deletions(-)
20 diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
21 index 9634317..9d42b31 100644
22 --- a/source3/winbindd/wb_fill_pwent.c
23 +++ b/source3/winbindd/wb_fill_pwent.c
24 @@ -141,8 +141,13 @@ static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq)
28 - fstrcpy(state->pw->pw_name, output_username);
29 - fstrcpy(state->pw->pw_gecos, state->info->full_name);
30 + strlcpy(state->pw->pw_name,
32 + sizeof(state->pw->pw_name));
33 + /* FIXME The full_name can be longer than 255 chars */
34 + strlcpy(state->pw->pw_gecos,
35 + state->info->full_name ? state->info->full_name : "",
36 + sizeof(state->pw->pw_gecos));
38 /* Home directory and shell */
39 ok = fillup_pw_field(lp_template_homedir(),