Blake Bender created GEODE-6007:
-----------------------------------

             Summary: Remove use of snprintf in NC code base
                 Key: GEODE-6007
                 URL: https://issues.apache.org/jira/browse/GEODE-6007
             Project: Geode
          Issue Type: Improvement
          Components: native client
            Reporter: Blake Bender


This is bad practice in general, and may open us up to maliciousness.  There 
are two main situations in which we find lots of usage of snprintf with raw 
char buffers, which are:
 * formatting messages for exceptions
 * formatting messages for logging

For the exception messages, we should switch to something known to be safe - a 
vsxprintf implementation, boost::format, std::stringstream, whatever.  As long 
as we stop declaring raw char buffers on the stack, it's all good

 

For logging, the situation is even dumber.  The various LOG* macros in the code 
_already_ take a format string and varargs, so as far as I know we essentially 
need to move the printf-style arguments into the logging macro and get rid of 
the other nonsense.  We may even buy a tiny performance improvement due to the 
fact that that logging macros can be compiled out of the code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to