The Bare Minimum
The soil pipe, also known as the vent stack or stack pipe, provides air for the plumbing system. Depending on your region, the vent stack may protrude only a few inches above the surface of the roof. This may seem suitable, since the only purpose for the stack is to provide air and expel sewer gases.
Many municipalities require the stack to protrude a minimum of six inches from the roof. Other municipalities require a minimum of twelve inches. Plumbing books vary in their advice.
According to the Uniform Plumbing Code, the soil pipe, or "stack pipe," shall extend "vertically not less than six (6) inches... above the roof nor less than one (1) foot... from any vertical surface." Local codes may be more stringent. It best to contact your municipal codes department to determine the correct length for your area.