Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions orm_lib/inc/drogon/orm/SqlBinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ class DROGON_EXPORT SqlBinder : public trantor::NonCopyable
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.

{
// if the sql is not null terminated, we need to copy it to a string
sqlPtr_ = std::make_shared<std::string>(sql, sqlLength);
sqlViewPtr_ = sqlPtr_->data();
sqlViewLength_ = sqlPtr_->length();
}
}

SqlBinder(SqlBinder &&that) noexcept
Expand Down
Loading