lib:tdb: Add missing overflow check for num_values in pytdb.c
authorAndreas Schneider <asn@samba.org>
Tue, 30 Apr 2024 12:16:33 +0000 (14:16 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 30 Apr 2024 14:30:34 +0000 (14:30 +0000)
commit82b07bd048e8039896be7edec6b83cbd6ff218d9
tree5d728adc0ebabc42df05e0f68153a399570d89c7
parente9c4538e272a32f9fe4dcdabc6f44b95ddfda6e7
lib:tdb: Add missing overflow check for num_values in pytdb.c

Error: INTEGER_OVERFLOW (CWE-190):
tdb-1.4.10/pytdb.c:401: cast_overflow: Truncation due to cast operation on "num_values" from 64 to 32 bits.
tdb-1.4.10/pytdb.c:401: overflow_sink: "num_values", which might have overflowed, is passed to "tdb_storev(self->ctx, key, values, num_values, flag)".
  399|           }
  400|
  401|->         ret = tdb_storev(self->ctx, key, values, num_values, flag);
  402|           free(values);
  403|           PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/tdb/pytdb.c