From: Nadav Har'El <n...@scylladb.com>
Committer: Waldemar Kozaczuk <wkozac...@waldemars-air.attlocal.net>
Branch: master

sched: fix gcc 9 warning

gcc 9.1.1 warns about strncpy() which can lead to a missing null at the
end of the destination. Let's use strlcpy(), which doesn't have this
problem.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
Message-Id: <20190519122628.6226-2-...@scylladb.com>

---
diff --git a/include/osv/sched.hh b/include/osv/sched.hh
--- a/include/osv/sched.hh
+++ b/include/osv/sched.hh
@@ -359,7 +359,7 @@ public:
             return *this;
         }
         attr& name(std::string n) {
-            strncpy(_name.data(), n.data(), sizeof(_name) - 1);
+            strlcpy(_name.data(), n.data(), sizeof(_name));
             return *this;
         }
     };

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000061742e058942c629%40google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to