Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/68#discussion_r38144291
--- Diff: core/sql/optimizer/opt.cpp ---
@@ -998,12 +998,18 @@ NAString Context::getRequirementsString() const
{
NAString IPPString("", CmpCommon::statementHeap());
- char thisptr[7 + sizeof(void *)];
+ // will receive the string "ptr=%p, ", where %p is a hex address
+ // example: "ptr=0x7fffffff23db, "
+ // so we need 4 bytes for "ptr=", 2 bytes for the "0x", up to
+ // 2 * sizeof(void *) bytes for the hex (each nibble goes to
+ // one ASCII character), 2 bytes for the ", " and 1 byte for
+ // the trailing null
+ char thisptr[4 + 2 + 2*sizeof(void *) + 2 + 1];
--- End diff --
Note to reviewers: I noticed this buffer overrun bug when I was debugging
and fixed it. Looked around for other similar bugs but did not find any.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---