ima: Replacing deprecated strlcpy with strscpy ~~~~~~~~~ Replace
Subsystems (2)
Jarkko Sakkinen
maintainerReply-To:
In-Reply-To: <[email protected]>
Quoted 6 lines · Palash Oswal
The
strlcpy()function is unsafe in that the source buffer length is unbounded or possibly be non NULL terminated. This can cause memory over-reads, crashes, etc.Signed-off-by Palash Oswal <[email protected]>
The long description does not explain what the commit does, and does not include any details about deprecation of strlcpy(), which at least I'm not aware of.
I don't think *length* ever is NULL terminated. The first sentence is somewhat weird. Also strlcpy() does have a bounds check.
Generally, the description and reasoning is sloppy to say the least.
/Jarkko
Quoted 37 lines
--- security/integrity/ima/ima_api.c | 2 +- security/integrity/ima/ima_policy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)security/integrity/ima/ima_api.c +1
-1@@ -399,7 +399,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; }security/integrity/ima/ima_policy.c +1
-1@@ -791,7 +791,7 @@ static int __init ima_init_arch_policy(void)char rule[255 ];int result; - result =strlcpy (rule, *rules,sizeof (rule)); +strscpy (rule, *rules,sizeof (rule));INIT_LIST_HEAD (&arch_policy_entry[i].list); result =ima_parse_rule (rule, &arch_policy_entry[i]);base-commit:
f6692213b5045dc461ce0858fb18cf46f328c202Signature · 1 line
2.27.0
Apologies for the in-accurate description. This patch is covered under the patch-set by Romain Perier ( https://lkml.org/lkml/2021/2/22/739 ) and can be disregarded.
Best Regards,
Palash
Quoted 62 lines · Jarkko Sakkinen
Reply-To:
In-Reply-To: <[email protected]>Quoted 6 lines · Palash Oswal
The
strlcpy()function is unsafe in that the source buffer length is unbounded or possibly be non NULL terminated. This can cause memory over-reads, crashes, etc.Signed-off-by Palash Oswal <[email protected]>The long description does not explain what the commit does, and does not include any details about deprecation of
strlcpy(), which at least I'm not aware of.I don't think *length* ever is NULL terminated. The first sentence is somewhat weird. Also
strlcpy()does have a bounds check.Generally, the description and reasoning is sloppy to say the least.
/Jarkko
Quoted 37 lines
--- security/integrity/ima/ima_api.c | 2 +- security/integrity/ima/ima_policy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)security/integrity/ima/ima_api.c +1
-1@@ -399,7 +399,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; }security/integrity/ima/ima_policy.c +1
-1@@ -791,7 +791,7 @@ static int __init ima_init_arch_policy(void)char rule[255 ];int result; - result =strlcpy (rule, *rules,sizeof (rule)); +strscpy (rule, *rules,sizeof (rule));INIT_LIST_HEAD (&arch_policy_entry[i].list); result =ima_parse_rule (rule, &arch_policy_entry[i]);base-commit:
f6692213b5045dc461ce0858fb18cf46f328c202--
2.27.0