If cube is axis-aligned, then it's easy.
You can compare each vertex of triangle with each face (plane) of cube. If it's out of cube (just compare apropriate coordinates), then find two new points, which lie on line connecting two other vertices with that one out of cube and which lie on plane (their coordinate is same as the plane). This is common linear interpolation. So I think you would handle it.
But you should be aware of case, which is on picture. Everytime choose point, which is closer to vertex, which is not out of cube (inner vertex). Choose green point, not red (which is closer to vertex out of cube).
Well. And if cube is not axis-aligned, you can look here: http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm#Triangle-Plane
There is intersection of triangle and plane (not axis aligned). You can use it and test it with all cube faces.
I hope I answered your question. If not, then punch me and ask again :)