Fix a buffer overflow.
The 6 byte logbook entry gets prepended to the profile data. We need to take this into account when allocating the memory buffer. Under normal circumstances this shouldn't be a problem, because a single dive is usually much smaller than the profile ringbuffer. But it's better to be on the safe side.
This commit is contained in:
parent
cde70334b0
commit
e79bd02f0a
@ -372,7 +372,7 @@ diverite_nitekq_extract_dives (dc_device_t *abstract, const unsigned char data[]
|
||||
data += SZ_PACKET;
|
||||
|
||||
// Allocate memory.
|
||||
unsigned char *buffer = (unsigned char *) malloc (RB_PROFILE_END - RB_PROFILE_BEGIN);
|
||||
unsigned char *buffer = (unsigned char *) malloc (SZ_LOGBOOK + RB_PROFILE_END - RB_PROFILE_BEGIN);
|
||||
if (buffer == NULL) {
|
||||
ERROR (context, "Failed to allocate memory.");
|
||||
return DC_STATUS_NOMEMORY;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user