Skip to content

Commit

Permalink
sched: fix gcc 9 warning
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
nyh authored and Waldemar Kozaczuk committed May 19, 2019
1 parent cb96e93 commit 27cf878
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/osv/sched.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down

0 comments on commit 27cf878

Please sign in to comment.