Page MenuHomePhabricator

[backport#16995] net: Fail instead of truncate command name in CMessageHeader

Authored by majcosta on Wed, May 20, 14:41.



Replace the memset/strncpy dance in CMessageHeader::CMessageHeader
with explicit code that copies then name and asserts the length.

This removes a warning in g++ 9.1.1 and IMO makes the code more readable
by not relying on strncpy padding and silent truncation behavior.

This is a partial backport of Core PR16995

Test Plan
ninja check

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

majcosta created this revision.Wed, May 20, 14:41
Herald added a reviewer: Restricted Project. · View Herald TranscriptWed, May 20, 14:41
majcosta requested review of this revision.Wed, May 20, 14:41
teamcity edited the summary of this revision. (Show Details)Wed, May 20, 14:41

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

jasonbcox accepted this revision.Wed, May 20, 17:30
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
53 ↗(On Diff #20359)

Nit: newline after /**

This revision is now accepted and ready to land.Wed, May 20, 17:30