Add guards to avoid calling strchr when @err_noinfo == NULL or
calling virErrorTestMsgFormatInfoOne when @err_info == NULL as
both would fail with a NULL deref.
Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
ret = -1;
}
- if (strchr(err_noinfo, '%')) {
+ if (err_noinfo && strchr(err_noinfo, '%')) {
VIR_TEST_VERBOSE("\nerror message id %zu contains formatting characters: '%s'\n",
i, err_noinfo);
ret = -1;
}
- if (virErrorTestMsgFormatInfoOne(err_info) < 0)
+ if (err_info && virErrorTestMsgFormatInfoOne(err_info) < 0)
ret = -1;
}