You're correct. I didn't see that Text1 was also a local variable within the function.

>if (Text1 == NULL) exit (1);

Don't use exit (1) here, but return NULL. Because then you can check Text1 in your other function. If it is NULL, something wrong happened.

>*temp = 0;

Try to change this to

*temp = '\0'

which is usually used to end a string.

>short Text1Length = (short) strlen (Text1) + 1;

That may be the reason of a failure here. Not sure about that, but you could try it. If I am correct then strlen expects a string which ends with '\0'.

Put some printf's in your code to trace what the functions do, where they exit, why they exit etc.