fix: replace str(n)(cat|cpy) with strl(cat|cpy)

Replaced all occurrences of strcpy, strncpy, and strncat with strlcpy/strlcat alternatives. Added CMake platform detection and BSD-compatible fallback implementation for systems that lack native strlcpy/strlcat.

Changes:

  • Added check_function_exists for strlcpy/strlcat in ConfigureChecks.cmake
  • Added HAVE_STRLCPY/HAVE_STRLCAT defines in config.h.cmake
  • Added fallback declarations in include/libssh/priv.h
  • Added fallback implementations in src/misc.c
  • Replaced 54 string function calls across 19 files (src/, examples/, tests/)

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • The project pipelines timeout is extended at least to 2 hours.

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by yubaraj Das

Merge request reports

Loading