Fix possible buffer overflow in selection code. We want to copy the

number of selected data since the offset, not the offset!
This commit is contained in:
Antony Riakiotakis 2014-09-23 19:05:31 +02:00
parent e422e56db0
commit 3906782406

@ -1181,14 +1181,14 @@ static short selectbuffer_ret_hits_15(unsigned int *UNUSED(buffer), const short
static short selectbuffer_ret_hits_9(unsigned int *buffer, const short hits15, const short hits9) static short selectbuffer_ret_hits_9(unsigned int *buffer, const short hits15, const short hits9)
{ {
const int offs = 4 * hits15; const int offs = 4 * hits15;
memcpy(buffer, buffer + offs, 4 * offs); memcpy(buffer, buffer + offs, 4 * hits9);
return hits9; return hits9;
} }
static short selectbuffer_ret_hits_5(unsigned int *buffer, const short hits15, const short hits9, const short hits5) static short selectbuffer_ret_hits_5(unsigned int *buffer, const short hits15, const short hits9, const short hits5)
{ {
const int offs = 4 * hits15 + 4 * hits9; const int offs = 4 * hits15 + 4 * hits9;
memcpy(buffer, buffer + offs, 4 * offs); memcpy(buffer, buffer + offs, 4 * hits5);
return hits5; return hits5;
} }