Without the guard (chain_size - 1), GCC analyzer spews the warning
below, which should be a false-positive:
ocsptool.c:532:32: warning: use of uninitialized value 'chain[1]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
532 | signer = chain[1];
| ~~~~~~~^~~~~~~~~~
Signed-off-by: Daiki Ueno <ueno@gnu.org>
app_exit(1);
}
- if (chain_size == 1)
- signer = chain[0];
- else
- signer = chain[1];
+ signer = chain[MIN(1, chain_size - 1)];
v = _verify_response(&dat, nonce, signer, 1);