According to a new study from Kansas State University, Halloween candy has a limited shelf life.

Depending on the type of candy, packaging and storage conditions, this shelf life can vary anywhere from two weeks to a year.

In general, the softer the candy, the shorter its shelf life.

Hard candies may last indefinitely, but people can actually get salmonella poisoning from eating expired chocolate.

Be on the lookout for expired chocolate that is extremely sticky or grainy, a flavor that seems "off" and a change in color.

"The less exposure to air, the better," said lead researcher Karen Blakeslee. "Also, store it at room temperature. Heat can cause many candies to melt and get too sticky. Chocolate can get a powdery look to it -- called bloom -- because of temperature changes, but it is still fine to eat."