Hardware wallets, which are recommended for holding significant amounts of cryptocurrency, are designed so that even if your normal computing devices get hacked or trojaned, the software running on them cannot steal the coins.
This is because the private keys are securely stored in the hardware wallet, which never reveals them to the outside world. The user has to physically confirm a transfer on the hardware wallet itself before funds can be spent (which is why they usually have either a small touchscreen or a non-touch screen plus physical buttons).
> And once the user has confirmed the transfer, the software could send the coins to a different address, right?
No, the destination address and amount to send need to be confirmed on the hardware wallet.
The hardware wallet cryptographically signs the entire transaction with the private key, so the software in the user's computer or mobile phone cannot change the transaction without the signature becoming invalid.
The software in the user's computer can't, but the software in the hardware wallet can. It's probably more secure than running the software on a conventional computer, this I can see.
The biggest problem probably isn't modifying the transaction, which is pretty easy to catch, but using predictable keys in the hardware or somehow leaking bits of the key in the transaction.
This way they could watch all the value stored in their wallets and steal whatever they wanted by making it look like you did it yourself when one had a large enough balance to be useful.