but getting the number part from the char* seems more tricky..
Using atoi() is tricky?
char* msg = (char*)malloc(size+1);
Not a good idea. You know the maximum (reasonable) size of a packet. Allocate a fixed size array.
value= String(msg[3])+String(msg[4])+String(msg[5]);
There is no excuse for converting each letter to a String. There is no excuse for using String at all.