Kitware / KWStyle

Kitware Style Checker
Other
53 stars 30 forks source link

sprintf is deprecated in MacOSX13.1.sdk #107

Closed thewtex closed 7 months ago

thewtex commented 1 year ago

Re: https://open.cdash.org/viewBuildError.php?type=1&buildid=8418071

[102/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkWASMImageIO.cxx.o
[103/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkWASMStringStream.cxx.o
[104/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkWASMMeshIO.cxx.o
[105/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkPipeline.cxx.o
[106/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkInputTextStream.cxx.o
[107/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkOutputTextStream.cxx.o
[108/141] Building CXX object src/CMakeFiles/WebAssemblyInterface.dir/itkIOComponentEnumFromWASMComponentType.cxx.o
[109/141] Performing build step for 'KWStyle'
[1/51] Building CXX object CMakeFiles/KWStyleLib.dir/kwsXMLReader.cxx.o
[2/51] Building CXX object CMakeFiles/KWStyleLib.dir/kwsCheckLineLength.cxx.o
KWStyle/kwsCheckLineLength.cxx:24:3: 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]
  sprintf(val,"Line Length = %ld max chars",max);
  ^
Build Log Line  1154
Warning 
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("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.")
^
Build Log Line  1157
Warning 
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
jhlegarreta commented 10 months ago

Has been reported here as well https://open.cdash.org/viewBuildError.php?type=1&buildid=9145072

following https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/pull/153

seanm commented 7 months ago

https://github.com/Kitware/KWStyle/pull/109

dzenanz commented 7 months ago

Should this be closed now?

seanm commented 7 months ago

There are a few remaining instances:

  1. in Perl files
  2. in PHP files
  3. in boost files

I would hope newer boost no longer uses sprintf, it should probably be updated.

I don't know PHP and Perl, so can't speak to that.

dzenanz commented 7 months ago

Updating boost in #111.

dzenanz commented 7 months ago

I assume that perl's and PHP's sprintf does not have buffer overrun risks of the C version.

seanm commented 7 months ago

I assume that perl's and PHP's sprintf does not have buffer overrun risks of the C version.

I would assume so too.

The boost update fixed the sprintf too.