Merge pull request #22301 from mrc0mmand/cocci-tweaks
fstab-generator: use str(n)dupa_safe() instead of plain str(n)dupa()
This commit is contained in:
@@ -721,7 +721,7 @@ static int sysroot_is_nfsroot(void) {
|
||||
if (!sep)
|
||||
return -EINVAL;
|
||||
|
||||
a = strndupa(arg_root_what + 1, sep - arg_root_what - 1);
|
||||
a = strndupa_safe(arg_root_what + 1, sep - arg_root_what - 1);
|
||||
|
||||
r = in_addr_from_string(AF_INET6, a, &u);
|
||||
if (r < 0)
|
||||
@@ -733,7 +733,7 @@ static int sysroot_is_nfsroot(void) {
|
||||
/* IPv4 address */
|
||||
sep = strchr(arg_root_what, ':');
|
||||
if (sep) {
|
||||
a = strndupa(arg_root_what, sep - arg_root_what);
|
||||
a = strndupa_safe(arg_root_what, sep - arg_root_what);
|
||||
|
||||
if (in_addr_from_string(AF_INET, a, &u) >= 0)
|
||||
return true;
|
||||
|
||||
@@ -803,7 +803,7 @@ TEST(config_parse_unit_env_file) {
|
||||
"EnvironmentFile", 0, "not-absolute",
|
||||
&files, u);
|
||||
assert_se(r == 0);
|
||||
assert_se(strv_length(files) == 0);
|
||||
assert_se(strv_isempty(files));
|
||||
|
||||
r = config_parse_unit_env_file(u->id, "fake", 1, "section", 1,
|
||||
"EnvironmentFile", 0, "/absolute1",
|
||||
|
||||
Reference in New Issue
Block a user