I've been begging for an End-of-Song marker (and Start-of-Song) for years. Noel even said it was a good idea, so I thought for sure it would be in versions 7, 8, 8.5 and X1. Never happened.
What I usually do is insert my own "Start" and "End" markers. Then, when I export, I press Ctl-A to select all tracks, go to the "Start" marker and press F9, then go to the "End" marker and press F10. This eliminates the need for subsequently trimming the output file.
But there is a downside to simply ignoring SONAR's notion of where the song ends like this, which is that there is no way to avoid it when freezing a track. I had one project that SONAR thought was 30 minutes long. Unfortunately, it included a mult-timbral soft synth that required a slow bounce, taking a whopping 90 minutes to freeze!
As Steve notes above, unending projects have some kind of event out there past the end of the song. If you can find it and delete it (automation nodes and MIDI events are the most common culprits) you can trim the project back. But I've had projects where I looked and looked and could not find anything at the point where Ctl-End took me to.
Here's how you deal with that situation:
1. Mark the
real end-of-song by inserting a marker there
2. Press Ctl-End to jump to where SONAR
thinks the song ends
3. Delete all automation nodes under the Now marker
4. Press Ctl-A to select all tracks
5. Press F10, then jump back to the "End" marker and press F9
6. Go to Edit -> Delete, make sure all options are checked
except "Markers", including "Delete Hole". Click OK.