Food that's only a few months past the expiration is generally safe for dogs.
While you may not touch a piece of expired food a day after it has expired, dogs can handle a lot more than humans can in terms of food and digestion.
However, before feeding the dog this food, check it for mold and bacteria.