cin >> buffer is a statement. While loops can take either statements or conditionals. A statement always evaluates to true. So what is happening is the while loop keeps running the statement, which evaluates to true, and you end up with an infinite loop.
If you want a useful answer some more context would be helpful. Where did you get the code form?