I'm currently recoding malloc() and need to deal with the case where a caller does a buffer size calculation that results in a negative value which is then passed to malloc() ?
I know that the parameter is a size_t, so an unsigned int am I right ?
This way, I wanted to check the size that will be passed to my recoded malloc(), but how can I do ?
Because if I pass a negative parameter it will be changed into a random number like 18446744073709551613 I just get.
So my question is : How can I check if the parameter is negative when the parameter is a size_t (unsigned int), it will be directly converted to an astronomical value, no ?