I don't know the interface you are attempting to work with however, it is customary for a remote set of code functions
to supply a function that will return data to your code..
The function will expect the size of the block you have, if it is not enough, it will return false but return the actual size it
needs, then you can reallocate the memory and then try it again with now the amount of memory it needs for the
call..
I am sure there are some specs somewhere that indicates this?