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:27:24 +0000 (16:27 +0200)
commit5609ea73a7152a3d97245823d2bceec6baaca3f5
tree5d728adc0ebabc42df05e0f68153a399570d89c7
parent286ddbd2b7a02bb4928a29dd579f37e3d66f958c
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