Most shelf-stable foods are safe indefinitely. In fact, canned goods will last for years, as long as the can itself is in good condition (no rust, dents, or swelling). Packaged foods (cereal, pasta, cookies) will be safe past the 'best by' date, although they may eventually become stale or develop an off flavor.