Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(libsinsp): do not rely on null-terminated string_views #1618

Merged

Conversation

LucaGuerra
Copy link
Contributor

@LucaGuerra LucaGuerra commented Jan 12, 2024

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind cleanup

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area libsinsp

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

During recent refactors of parameter handling in parsers we introduced std::string_views to handle strings coming from the drivers. However, in subsequent calls that required const char * we relied on the fact that those string views had a NUL right after the end. This is technically an oob read (although harmless in this case) and so we just need to handle this properly by using std::strings when necessary. We already got rid of a few instances, this PR cleans up the rest of them.

cc @gnosek @FedeDP

/milestone 0.15.0

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copy link
Contributor

@incertum incertum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite happy to see this string handling cleanup, because as you know some inconsistencies drove me nuts in recent patches we worked on together lately 😉 .

@FedeDP
Copy link
Contributor

FedeDP commented Jan 15, 2024

Must be rebased on master to fix ci i guess :) (#1617)

Signed-off-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Luca Guerra <luca@guerra.sh>
@LucaGuerra LucaGuerra force-pushed the cleanup/string-view-nullterm-to-string branch from 15c6b51 to d8cdad2 Compare January 15, 2024 08:42
Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana
Copy link
Contributor

poiana commented Jan 15, 2024

LGTM label has been added.

Git tree hash: 6ecc4356133415e9839f48a7ce348740cf0272f1

Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana
Copy link
Contributor

poiana commented Jan 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, jasondellaluce, LucaGuerra

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Andreagit97,LucaGuerra,jasondellaluce]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit fc4b79c into falcosecurity:master Jan 17, 2024
31 checks passed
@LucaGuerra LucaGuerra deleted the cleanup/string-view-nullterm-to-string branch February 12, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants