Correct off by 1 in malloc, which causes this to fail on macOS (and in theory on any platform).

__archive__
mwachs5 2016-12-23 17:53:26 -08:00
parent b474c22b33
commit ddb4caf846
1 changed files with 1 additions and 1 deletions

View File

@ -676,7 +676,7 @@ void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data)
while (count > 0) { while (count > 0) {
unsigned step_count = MIN(count, 255); unsigned step_count = MIN(count, 255);
assert(as->used < as->size); assert(as->used < as->size);
as->steps[as->used] = malloc(step_count + 1); as->steps[as->used] = malloc(step_count + 2);
as->steps[as->used][0] = STEP_TX; as->steps[as->used][0] = STEP_TX;
as->steps[as->used][1] = step_count; as->steps[as->used][1] = step_count;
memcpy(as->steps[as->used] + 2, data, step_count); memcpy(as->steps[as->used] + 2, data, step_count);