Drive voltage regulator Vout when Vin is floating
It is true that the datasheet of the L78S05 does not really give explicit information on this usage. For some other devices, there is a clear limit given in the "Absolute Maximum ratings" table, that indicates the maximum difference between input and output voltage: e.g. for LM317, it says "-0.3V max". When you see this in the datasheet, it clearly means you need a protection diode from the output to the input, so that the input never goes further below the output. But it is not the case here.

But there is a clue given in the datasheet:


The protection diode I was talking about is suggested here "when input is short-circuited, and if there is high capacitance load, and for output voltage grater than 6 volts". The datasheet explains this is because of the base-emitter junction rating.

This actually means there is no real risk of destroying the regulator in your case. The base-emitter junction can tolerate 6V, and in your case there won't be more than 5V. Moreover, the risk only exists when input is short-circuited (because in this case there is a large current flowing back from output to input). In your case, input is just floating, so the current will be null (or maybe just some insignificant leakage).

So you could leave it like that. Now, if you really want belt and suspenders and take care of the case where input is short-circuited instead of just floating, you could add the above protection diode, then you'll be more than safe.