Skip to content

Check overflow in init(8).

Nicholas De Nova requested to merge nanovad/sortix:init-overflow-fixes into master

Instead of multiplying new_length by 2, which could cause a multiplication overflow, multiply sizeof(struct harddisk*) by 2.
This makes reallocarray perform an additional overflow check - namely that new_length * 2 does not overflow.
sizeof(struct harddisk*) is not likely to be more than SIZE_MAX/2, so this is probably safe.

Merge request reports