# HG changeset patch # User Matti Hamalainen # Date 1518812683 -7200 # Node ID e6c8a235ce2fa64c09249550922612e91c9d6c1f # Parent eb343ac259f411798ebab45ad68228d0f6c9212b Fix the load address handling in case of new SLDB format. diff -r eb343ac259f4 -r e6c8a235ce2f sidlib.c --- a/sidlib.c Fri Feb 16 22:08:11 2018 +0200 +++ b/sidlib.c Fri Feb 16 22:24:43 2018 +0200 @@ -48,10 +48,10 @@ static BOOL si_read_hash_data(th_ioctx *ctx, PSIDHeader *psid, - th_md5state_t *state, BOOL first) + th_md5state_t *state, const BOOL newSLDB) { uint8_t *data = NULL; - BOOL ret = FALSE; + BOOL ret = FALSE, first = TRUE; size_t read; if ((data = (uint8_t *) th_malloc(PSID_BUFFER_SIZE)) == NULL) @@ -81,8 +81,12 @@ // Grab the load address psid->loadAddress = TH_LE16_TO_NATIVE(*(uint16_t *) data); - // .. do not include the load address to the hash - th_md5_append(state, &data[2], read - 2); + // .. do not include the load address to the hash if OLD SLDB format + if (newSLDB) + th_md5_append(state, data, read); + else + th_md5_append(state, &data[2], read - 2); + first = FALSE; } else