I can tell you what NOT to say:
"It's all about Positive Mental Attitude!"
"Here's a website link about a little gadget, a black box with electrical pads on it. It can cure cancer, heart problems, all sorts of things..."
"I know just how you feel. My 93-year-old mother has cancer ..."
"Cancer is caused by sugar. Cut out all sugars and it may stop the cancer."
"Hey, do you want to join our next scuba diving trip to the Red Sea?"
All of those are real examples from when my husband had terminal cancer. I think what he wanted most was to do normal everyday things for as long as possible: walks, pub visits, cofffee and chocolate cake in the garden with friends, etc.
There may come a point when practical help is appreciated: shopping, lifts to the hospital or the surgery, etc. The one thing that did cause hurt was when certain friends seemed to avoid us or stopped communicating. Just say what you feel, however bumbling and clumsy it may be, but don't feel you have to offer a solution or a cure, you can't do that. Just let them know you're there for them.