Skip to content

Conversation

@an-tao
Copy link
Member

@an-tao an-tao commented Jun 4, 2025

to fix #2328

Copy link
Contributor

@LordMZTE LordMZTE left a comment

Choose a reason for hiding this comment

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

I think we unfortunately can't check if there is a null byte; we probably have to store whether there is one or not once we get the SQL from the user. In case the user gives us a std::string_view, we can probably assume that there is none, if we get a char* we can assume there is.

client_(client),
type_(type)
{
if (sql[sqlLength] != '\0')
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is sound; if sql ends at a page boundary, the access of sql[sqlLength] would be out-of-bounds and could cause a segfault.

@an-tao an-tao marked this pull request as draft July 2, 2025 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PgBatchConnection may pass strings without a null terminator to libpq APIs

3 participants