On 18.07.23 23:00, Julien Grall wrote:
Hi Juergen,On 10/07/2023 07:59, Juergen Gross wrote:- return (struct xs_tdb_record_hdr *)data.dptr; + *size = sizeof(*hdr) + hdr->num_perms * sizeof(hdr->perms[0]) + + hdr->datalen + hdr->childlen; + + p = talloc_size(NULL, *size); + if (!p) { + errno = ENOMEM; + return NULL; + } + + trace_tdb("read %s size %zu\n", db_name, *size + strlen(db_name)); + + /* Return a copy, avoiding a potential modification in the DB. */ + memcpy(p, hdr, *size);The talloc_size() + memcpy() seems to be an open-coded version of talloc_memdup(). Can you use it?
Oh, good idea.
The rest looks good to me.
Thanks, Juergen
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
