Let's say you have an H-1 which was good until August and you came to the airport in January and they gave you a I-94 good only till June because your passport was expiring in June. In that case, you have two options. If your passport is renewed and your visa is still good you can go outside and come back using the approval notice and the visa on your passport. You should be given the entire time remaining given in your petition plus 10 days.
The second option is if you still have time on the I-94 that was given to you at the airport you can apply for an extension while you are within the USA. More...
Note: This is a verbatim transcript of the referenced audio/video media delivered as oral communication, and, therefore, may not conform to written grammatical or syntactical form.