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:
Yu Watanabe
2022-01-30 09:34:44 +09:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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",