Generally, you have no protection for sharing ideas. If you’re sitting at a table with your professors bandying concepts about, either of them can take them and use them. But that’s not the end of the story. The more your idea gets expressed in something tangible -- such as a physical prototype of your invention (which could be patented) -- the closer you are to protecting it … provided you begin to take the right steps to file with the appropriate department.
Another way to protect your idea is with the use of a confidentiality and non-disclosure agreement (often referred to as an NDA). However, NDAs need to be drafted carefully, and the ones freely available on the Internet often aren’t. Finally, your school may have a code of ethics that all educators and administrators have to abide by if they are going to encourage innovation and entrepreneurship in their students. Otherwise, students may feel reluctant to go to the very people (professors and deans) whose help they need. Find out from your school whether they have these terms and/or whether your professor would sign an NDA.