The Clang static code analyser emits a warning:
$ scan-build clang -c ini.c
scan-build: Using '/usr/lib/llvm-18/bin/clang' for static analysis
ini.c:164:56: warning: The left operand of '!=' is a garbage value [core.UndefinedBinaryOperatorResult]
164 | if (offset == max_line - 1 && line[offset - 1] != '\n') {
| ~~~~~~~~~~~~~~~~ ^
1 warning generated.
scan-build: Analysis run complete.
scan-build: 1 bug found.
scan-build: Run 'scan-view /tmp/scan-build-2026-01-05-114423-34279-1' to examine bug reports.
$
While it looks like a false positive, it would be nice to silence the warning message. One way to do that would be to initialise line in ini_reader_string:
#ifdef __clang_analyzer__
memset(str, '\0', num);
#endif
See also openconnect/ocserv#437.
The Clang static code analyser emits a warning:
While it looks like a false positive, it would be nice to silence the warning message. One way to do that would be to initialise
lineinini_reader_string:See also openconnect/ocserv#437.