That's correct, you can't find out from a pointer how much memory was allocated. You'll have to pass a size along with the allocated memory.
When you call sizeof() on a pointer, it will return you the sizeof that pointer.
In this case, you have a string, so you can use strlen() to find the length. Provided that the string is terminated with a NULL. Though the best option is still to pass another argument, specifying the length of the buffer.

QuantumPete