]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: use str(n)dupa_safe() instead of plain str(n)dupa()
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 29 Jan 2022 21:34:02 +0000 (22:34 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 29 Jan 2022 21:34:02 +0000 (22:34 +0100)
src/fstab-generator/fstab-generator.c

index 9b32383a76637bd5f237cdbd481a2e791580d5f3..ca9b045e85952d8a5af9d7598b66494b2631e426 100644 (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;