magic in TDB struct list_struct possibly in wrong position ...

Richard Sharpe realrichardsharpe at
Mon Jan 19 21:24:59 GMT 2009


I notice that in tdb_internal we have:

struct list_struct {
        tdb_off_t next; /* offset of the next record in the list */
        tdb_len_t rec_len; /* total byte length of record */
        tdb_len_t key_len; /* byte length of key */
        tdb_len_t data_len; /* byte length of data */
        u32 full_hash; /* the full 32 bit hash of the key */
        u32 magic;   /* try to catch errors */
        /* the following union is implied:
                union {
                        char record[rec_len];
                        struct {
                                char key[key_len];
                                char data[data_len];
                        u32 totalsize; (tailer)

However, I would imagine that a common error is to write more data
than we said we would in a record.

We would catch more of these cases if magic was the first field in the
list_struct it seems to me.

Richard Sharpe

More information about the samba-technical mailing list