From 959516d61bc6ee7cdd12409dde0ec00044208f1b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 Mar 2012 17:13:07 -0700 Subject: More strlcat/strlcpy truncate checks. --- source3/utils/net_rpc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 4aaf365a88..ad3f448c5e 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -3765,8 +3765,12 @@ static NTSTATUS copy_fn(const char *mnt, struct file_info *f, } /* search below that directory */ - strlcpy(new_mask, dir, sizeof(new_mask)); - strlcat(new_mask, "\\*", sizeof(new_mask)); + if (strlcpy(new_mask, dir, sizeof(new_mask)) >= sizeof(new_mask)) { + return NT_STATUS_NO_MEMORY; + } + if (strlcat(new_mask, "\\*", sizeof(new_mask)) >= sizeof(new_mask)) { + return NT_STATUS_NO_MEMORY; + } old_dir = local_state->cwd; local_state->cwd = dir; @@ -4807,7 +4811,9 @@ static bool get_user_tokens_from_file(FILE *f, token = &((*tokens)[*num_tokens-1]); - strlcpy(token->name, line, sizeof(token->name)); + if (strlcpy(token->name, line, sizeof(token->name)) >= sizeof(token->name)) { + return false; + } token->token.num_sids = 0; token->token.sids = NULL; continue; -- cgit