cid#1591493 Unchecked return value

Change-Id: I0d39e142d3fd4100f68f1fff3f9d305aa1b59728
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162954
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-02-03 14:24:07 +00:00
parent d842ba65ec
commit 990b9d7acc
2 changed files with 7 additions and 3 deletions

View file

@ -75,7 +75,7 @@ namespace {
sal_Int32 random() {
sal_Int32 n;
rtlRandomPool pool = rtl_random_createPool();
rtl_random_getBytes(pool, &n, sizeof n);
(void)rtl_random_getBytes(pool, &n, sizeof n);
rtl_random_destroyPool(pool);
return n;
}

View file

@ -71,17 +71,21 @@ namespace
namespace comphelper::xml
{
// Generate some 'chaff' of varying length to be the body of an
// XML comment to put at the start of encrypted content to make
// document content a little less predictable.
// See SvXMLExport::addChaffWhenEncryptedStorage
OString makeXMLChaff()
{
rtlRandomPool pool = rtl_random_createPool();
sal_Int8 n;
rtl_random_getBytes(pool, &n, 1);
(void)rtl_random_getBytes(pool, &n, 1);
sal_Int32 nLength = 1024+n;
// coverity[tainted_data] - 1024 deliberate random minus max -127/plus max 128
std::vector<sal_uInt8> aChaff(nLength);
rtl_random_getBytes(pool, aChaff.data(), nLength);
(void)rtl_random_getBytes(pool, aChaff.data(), nLength);
rtl_random_destroyPool(pool);