X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fexpire%2Fserv_expire.c;fp=citadel%2Fmodules%2Fexpire%2Fserv_expire.c;h=d81880858f9a3ad648e18f0140c30286223dde2e;hp=d1567007455fb65d9979cd19b7c77f36663ee396;hb=c54bcf54bb3a1c23f81d830142b7fd02c91503c1;hpb=6f450641c20805d17cf0e2c1397719cb0c02562a diff --git a/citadel/modules/expire/serv_expire.c b/citadel/modules/expire/serv_expire.c index d15670074..d81880858 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -706,15 +706,18 @@ int PurgeUseTable(void) { cdb_rewind(CDB_USETABLE); while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) { - /* - * TODODRW: change this to create a new function time_t cdb_get_timestamp( struct cdbdata *) - * this will release this file from the serv_network.h - * Maybe it could be a macro that extracts and casts the reult - */ - memcpy(&ut, cdbut->ptr, - ((cdbut->len > sizeof(struct UseTable)) ? - sizeof(struct UseTable) : cdbut->len)); - cdb_free(cdbut); + /* + * TODODRW: change this to create a new function time_t cdb_get_timestamp( struct cdbdata *) + * this will release this file from the serv_network.h + * Maybe it could be a macro that extracts and casts the reult + */ + if (cdbut->len > sizeof(struct UseTable)) + memcpy(&ut, cdbut->ptr, sizeof(struct UseTable)); + else { + memset(&ut, 0, sizeof(struct UseTable)); + memcpy(&ut, cdbut->ptr, cdbut->len); + } + cdb_free(cdbut); if ( (time(NULL) - ut.ut_timestamp) > USETABLE_RETAIN ) { uptr = (struct UPurgeList *) malloc(sizeof(struct UPurgeList));