Verify the header in the logbook and profile are identical.

Unless we have a bug in the logbook processing logic, both logbook
headers should always be identical. But it doesn't hurt to check
explicitly.
This commit is contained in:
Jef Driesen 2012-09-17 21:26:06 +02:00
parent 9366e36309
commit ae763c3f58

View File

@ -455,6 +455,15 @@ hw_frog_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
return rc;
}
// Verify the header in the logbook and profile are identical.
if (memcmp (profile, header + offset, RB_LOGBOOK_SIZE) != 0) {
ERROR (abstract->context, "Unexpected profile header.");
free (profile);
free (header);
return rc;
}
if (callback && !callback (profile, length, profile + 9, sizeof (device->fingerprint), userdata))
break;
}