Hi ,
I was once asked to debug the following code. The code is attached as an image file:
I have found the following Bugs but I would like some other thoughts too :
1 ) Should Bool be a defined type then , succeeded should be initialized to False
2 ) Line 28 : if size_t is defined as long in a 64 bit system then its passsed to uint32 which will make it lose higher 32 bits
3 ) Malloc(0) is a possibility
4) malloc may return error but its not checked or accounted
5) String has to be NULL terminated
6) *s is assigned the allocated and assigned the memory by s is passed..
I hope there are lots more in this. Please post your thoughts