Most people are surprised that cooked pasta and rice is a food poisoning risk. In fact if you are entertaining and your fridge is full it is often the cooked rice or pasta that is left out.
Dried rice and pasta will last a considerable time so follow the best before date on the packaging.
Once it is cooked and begins to cool then toxins formed by Bacillus cereus can form heat resistant spores and a heat resistant toxin. If cooked food is allowed to cool slowly the spores can germinate and reheating or lightly cooking the food will not destroy this toxin. The bacteria can grow and produce toxin at refrigeration temperatures, it does so much more slowly than at room temperature.
Precooked food should not be stored in the refrigerator for more than two to three days.