Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10022

Replace sprintf with snprintf in bench and test code

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • WT11.1.0, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • 2
    • Storage Engines - 2022-10-31

      Summary

      Compiling WiredTiger with no compilation flags using Apple clang version 14.0.0 fails to compile workgen and some csuite tests with the message

      warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

      This is due to sprintf writing past the end of the buffer when input is longer than the buffer. snprintf instead truncates input to the size of the buffer and should be used instead.

            Assignee:
            andrew.morton@mongodb.com Andrew Morton
            Reporter:
            andrew.morton@mongodb.com Andrew Morton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: