What stops rust on a wood stove?

There is a product specifically for this, called stove black. It is available at many hardware stores. A wood stove that is in use at least periodically will not rust much because it is being kept dry, and stove black pretty much stops rust.

Things not to use include any ordinary paint or oil. Anything that will burn or decompose when heated very hot is very much to be avoided. In fact, use of such things can be very unsafe, as they can produce toxic fumes.