ctdb-ib: Replace uses of sprintf()

This was going to be bug https://bugzilla.samba.org/show_bug.cgi?id=15918 with associated CVE-2025-59519. However, the problematic code is never executed in ctdbd so I'm going to fix it, just in case future development causes it to be executed, but I'm not planning to backport it to stable releases because that would be a waste of effort.

See commit message for more details.

Skipping the CI pipeline because it does not do a build with the --enable-infiniband configure option, so would be a waste of CI resources. Instead, here is elided output from a relevant standalone build done in the ctdb/ subdirectory:

$ ./configure --enable-developer --enable-infiniband --bundled-libraries=ALL
Setting top to                           : /home/martins/samba/samba-worktrees/ctdb-ib 
Setting out to                           : /home/martins/samba/samba-worktrees/ctdb-ib/ctdb/bin 
...
'configure' finished successfully (33.369s)
$ make -j
PYTHONHASHSEED=1 WAF_MAKE=1  ../buildtools/bin/waf build
Waf: Entering directory `/home/martins/samba/samba-worktrees/ctdb-ib/ctdb/bin/default'
Checking project rules ...
Project rules pass
...
[189/422] Compiling ctdb/ib/ibwrapper.c
...
Waf: Leaving directory `/home/martins/samba/samba-worktrees/ctdb-ib/ctdb/bin/default'
Build commands will be stored in bin/default/compile_commands.json
'build' finished successfully (7.221s)

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • (optional) This MR is just one part towards a larger feature.
  • (optional, if backport required) Bugzilla bug filed and BUG: tag added
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • CI timeout is 3h or higher (see Settings/CICD/General pipelines/ Timeout)

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to README.Coding.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports

Loading