Skip to content

Deprecation Warning for sprintf #26814

@shyama7004

Description

@shyama7004

System Information

Operating System: macOS 14.4
Compiler: Clang (Apple LLVM version)
OpenCV Version: 4.11.0
Platform: macOS ARM64 (M1 chip)

Detailed description

While building the OpenCV codebase, I encountered multiple warnings related to the usage of sprintf, which is deprecated in the macOS 14 SDK. The warnings recommend replacing sprintf with snprintf due to security concerns, as sprintf lacks bounds checking.

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.

Steps to reproduce

cmake -DOPENCV_EXTRA_MODULES_PATH=<path_to_opencv_contrib_modules> \
      -DOPENCV_TEST_DATA_PATH=<path_to_opencv_extra_testdata> \
      -DBUILD_TESTS=ON ..
make -j4

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions