Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-6007

Fix LGTM complaints in NC code base

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.11.0
    • native client
    • None

    Description

      This is showing stuff that 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.

       

      UPDATE:  Report from running LGTM on our code may be found at https://lgtm.com/projects/g/apache/geode-native/alerts/?mode=list.  This report has issues with tons of printf-style format specifiers, so it catches most of the snprintf stuff pointed out above.  MANY OF THESE ARE BUFFER OVERFLOW ISSUES, and must be addressed in the name of security.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bbender Blake Bender
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h
                2h