1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

journal: assert gcry_mpi_scan succeeded

It might be nicer to propagate the error to the caller, but that'd
be a bigger refactoring. This shouldn't really fail, so just add
an assert.

CID #1349697.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-04-08 21:08:54 -04:00
parent 9d4e7d1380
commit ddea446252

View File

@ -58,7 +58,7 @@ static gcry_mpi_t mpi_import(const void *buf, size_t buflen) {
gcry_mpi_t h;
unsigned len;
gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL);
assert_se(gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL) == 0);
len = (gcry_mpi_get_nbits(h) + 7) / 8;
assert(len <= buflen);
assert(gcry_mpi_cmp_ui(h, 0) >= 0);