drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laur...@apache.org
Subject drill git commit: DRILL-5668: Fix C++ connector crash on error
Date Wed, 12 Jul 2017 17:58:17 GMT
Repository: drill
Updated Branches:
  refs/heads/master 35a1ec667 -> 35d07c3bd


DRILL-5668: Fix C++ connector crash on error

Fix C++ connector crash when receiving error messages exceeding
a given size.

closes #873


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/35d07c3b
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/35d07c3b
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/35d07c3b

Branch: refs/heads/master
Commit: 35d07c3bd84ee8e8a4019a18888461e130c45d42
Parents: 35a1ec6
Author: Laurent Goujon <laurent@dremio.com>
Authored: Tue Jul 11 22:25:44 2017 -0700
Committer: Laurent Goujon <laurent@dremio.com>
Committed: Wed Jul 12 10:57:27 2017 -0700

----------------------------------------------------------------------
 contrib/native/client/src/clientlib/drillClientImpl.cpp | 4 ++--
 contrib/native/client/src/clientlib/errmsgs.cpp         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/35d07c3b/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 7015b5a..3f9f958 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -2377,7 +2377,7 @@ status_t DrillClientQueryResult::setupColumnDefs(exec::shared::QueryData*
pQuery
         for(std::vector<Drill::FieldMetadata*>::iterator it = this->m_columnDefs->begin();
it != this->m_columnDefs->end(); ++it){
             // the key is the field_name + type
             char type[256];
-            sprintf(type, ":%d:%d",(*it)->getMinorType(), (*it)->getDataMode() );
+            snprintf(type, sizeof(type), ":%d:%d",(*it)->getMinorType(), (*it)->getDataMode()
);
             std::string k= (*it)->getName()+type;
             oldSchema[k]=*it;
             delete *it;
@@ -2394,7 +2394,7 @@ status_t DrillClientQueryResult::setupColumnDefs(exec::shared::QueryData*
pQuery
             //Look for changes in the vector and trigger a Schema change event if necessary.
             //If vectors are different, then call the schema change listener.
             char type[256];
-            sprintf(type, ":%d:%d",fmd->getMinorType(), fmd->getDataMode() );
+            snprintf(type, sizeof(type), ":%d:%d",fmd->getMinorType(), fmd->getDataMode()
);
             std::string k= fmd->getName()+type;
             std::map<std::string, Drill::FieldMetadata*>::iterator iter=oldSchema.find(k);
             if(iter==oldSchema.end()){

http://git-wip-us.apache.org/repos/asf/drill/blob/35d07c3b/contrib/native/client/src/clientlib/errmsgs.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/errmsgs.cpp b/contrib/native/client/src/clientlib/errmsgs.cpp
index 56510ec..15d2256 100644
--- a/contrib/native/client/src/clientlib/errmsgs.cpp
+++ b/contrib/native/client/src/clientlib/errmsgs.cpp
@@ -77,7 +77,7 @@ std::string getMessage(uint32_t msgId, ...){
     assert((ERR_NONE <= msgId) && (msgId < ERR_QRY_MAX));
     va_list args;
     va_start (args, msgId);
-    vsprintf (str, errorMessages[msgId-DRILL_ERR_START].msgFormatStr, args);
+    vsnprintf (str, sizeof(str), errorMessages[msgId-DRILL_ERR_START].msgFormatStr, args);
     va_end (args);
     s=std::string("[")+boost::lexical_cast<std::string>(msgId)+std::string("]")+str;
     return s;


Mime
View raw message