Skip to content

Commit

Permalink
ima: Use strscpy instead of strlcpy
Browse files Browse the repository at this point in the history
strlcpy is deprecated, use its safer replacement.

Signed-off-by: Petr Vorel <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
  • Loading branch information
pevik authored and mimizohar committed Oct 10, 2021
1 parent 61868ac commit cc4299e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ const char *ima_d_path(const struct path *path, char **pathbuf, char *namebuf)
}

if (!pathname) {
strlcpy(namebuf, path->dentry->d_name.name, NAME_MAX);
strscpy(namebuf, path->dentry->d_name.name, NAME_MAX);
pathname = namebuf;
}

Expand Down
2 changes: 1 addition & 1 deletion security/integrity/ima/ima_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static int __init ima_init_arch_policy(void)
char rule[255];
int result;

result = strlcpy(rule, *rules, sizeof(rule));
result = strscpy(rule, *rules, sizeof(rule));

INIT_LIST_HEAD(&arch_policy_entry[i].list);
result = ima_parse_rule(rule, &arch_policy_entry[i]);
Expand Down

0 comments on commit cc4299e

Please sign in to comment.