Skip to content

Commit 27cf878

Browse files
nyhWaldemar Kozaczuk
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]>
1 parent cb96e93 commit 27cf878

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/osv/sched.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public:
359359
return *this;
360360
}
361361
attr& name(std::string n) {
362-
strncpy(_name.data(), n.data(), sizeof(_name) - 1);
362+
strlcpy(_name.data(), n.data(), sizeof(_name));
363363
return *this;
364364
}
365365
};

0 commit comments

Comments
 (0)