From 8380835fc6de38706d9af29dc7f0fa4cec4f9c90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 May 2011 11:38:26 -0700 Subject: Fix warning messages caused by addition of null check in fstrcpy macro. --- source3/utils/net_groupmap.c | 10 +++++----- source3/utils/net_rpc.c | 6 +++--- source3/utils/smbpasswd.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index 818905e122..9145093f52 100644 --- a/source3/utils/net_groupmap.c +++ b/source3/utils/net_groupmap.c @@ -130,7 +130,7 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv) GROUP_MAP map; if ( sid_string[0] ) - fstrcpy( ntgroup, sid_string); + strlcpy(ntgroup, sid_string, sizeof(ntgroup)); if (!get_sid_from_input(&sid, ntgroup)) { return -1; @@ -324,7 +324,7 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv) } if (!ntgroup[0] ) - fstrcpy( ntgroup, unixgrp ); + strlcpy(ntgroup, unixgrp, sizeof(ntgroup)); if (!NT_STATUS_IS_OK(add_initial_entry(gid, string_sid, sid_type, ntgroup, ntcomment))) { d_fprintf(stderr, _("adding entry for group %s failed!\n"), ntgroup); @@ -457,10 +457,10 @@ static int net_groupmap_modify(struct net_context *c, int argc, const char **arg /* Change comment if new one */ if ( ntcomment[0] ) - fstrcpy( map.comment, ntcomment ); + strlcpy(map.comment, ntcomment, sizeof(map.comment)); if ( ntgroup[0] ) - fstrcpy( map.nt_name, ntgroup ); + strlcpy(map.nt_name, ntgroup, sizeof(map.nt_name)); if ( unixgrp[0] ) { gid = nametogid( unixgrp ); @@ -528,7 +528,7 @@ static int net_groupmap_delete(struct net_context *c, int argc, const char **arg /* give preference to the SID if we have that */ if ( sid_string[0] ) - fstrcpy( ntgroup, sid_string ); + strlcpy(ntgroup, sid_string, sizeof(ntgroup)); if ( !get_sid_from_input(&sid, ntgroup) ) { d_fprintf(stderr, _("Unable to resolve group %s to a SID\n"), diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index a3657262c4..43398524ec 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -3763,8 +3763,8 @@ static NTSTATUS copy_fn(const char *mnt, struct file_info *f, } /* search below that directory */ - fstrcpy(new_mask, dir); - fstrcat(new_mask, "\\*"); + strlcpy(new_mask, dir, sizeof(new_mask)); + strlcat(new_mask, "\\*", sizeof(new_mask)); old_dir = local_state->cwd; local_state->cwd = dir; @@ -4802,7 +4802,7 @@ static bool get_user_tokens_from_file(FILE *f, token = &((*tokens)[*num_tokens-1]); - fstrcpy(token->name, line); + strlcpy(token->name, line, sizeof(token->name)); token->token.num_sids = 0; token->token.sids = NULL; continue; diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index ada057c247..8c780498b5 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -378,7 +378,7 @@ static int process_root(int local_flags) */ slprintf(buf, sizeof(buf)-1, "%s$", user_name); - fstrcpy(user_name, buf); + strlcpy(user_name, buf, sizeof(user_name)); } else if (local_flags & LOCAL_INTERDOM_ACCOUNT) { static fstring buf; @@ -395,7 +395,7 @@ static int process_root(int local_flags) /* prepare uppercased and '$' terminated username */ slprintf(buf, sizeof(buf) - 1, "%s$", user_name); - fstrcpy(user_name, buf); + strlcpy(user_name, buf, sizeof(user_name)); } else { -- cgit