I am writing a kind of dinky program in c which requires the user to enter a username and password. I know it's not really necessary, but I kind of like thinking about the security side of things. I hash the password before saving it to a file, but is it possible for another program to find the inputted password in memory during run-time? Is there any difference if the password is stored in the stack versus the heap? Is there any inherent vulnerability in returning the password from a function un-hashed rather than hashing it as soon as it is inputted?
Sorry if this is a little off topic, just a curious student :)