This scene was found in Billy Madison (1995).
How do they shoot dangerous stunt scenes?
Movies & TV Stack Exchange is a question and answer site for movie and TV enthusiasts. It only takes a minute to sign up.Sign up to join this community
The stuntman/stuntwoman wears a special flame-retardant suit under their costume. In addition, any skin which is not covered by the suit gets coated with a special gel which is flame-resistant. Additionally, there are a few people with fire extinguishers in hand who jump in immediately after the director cuts the scene to extinguish the flames.
For that movie it was probably using a pyro gel. It's a special gel that burns at a lower temperature (800F) and doesn't spread much, so it can be applied more precisely. To protect themselves the actors use a combination of a Stunt Gel (acts as a temperature isolation) and fire resistant clothes.
That said, it's a high risk stunt and not for amateurs. The safer way would be to use CGI to add the flames digitally later, although possibly won't look as convincing as real flames.