Let's say I find someone who wants to sell Bitcoins and I want to buy them for cash. If we both meet at a public Wifi and I watch them send the Bitcoins to my address from their wallet, and I give them cash, are there any risks associated with this?
Obviously, they could try to rob me and just take my cash, but aside from this, are there any other risks?
Yes. If you are on Wi-Fi and running the Bitcoin.org client, then the counterparty knows the IP address for your node. If you are configured to allow incoming transactions, then the counterparty might have a pretty good attack vector if you have your node misconfigured for acting as a merchant.
With proper preparation, the counterparty has a node specifically connect to yours. Then at the time of the trade creates a payment to your address and broadcasts that transaction to your node only. At the same time, or a fraction of a second earlier another transaction using those same coins for the payment to you is broadcast instead to well connected nodes and known miner nodes. As a result, you may see the transaction at 0/unconfirmed and you would then think you have the funds. But the miners will likely reject that transaction relayed by your node because a transaction they just had received had already spent the coins your node thinks it will be receiving.
In that situation, the transaction you see will remain 0/unconfirmed, and the counterparty take the cash you handed over, never to be seen again.
If the counterparty had bad luck and the transaction sent to you got relayed first to a miner that solves a block, that transaction would then eventually confirm but then it is just a normal trade -- you got coins and the counterparty got your cash. When this happens then unless you were specifically monitoring the network looking for a double spend attempt, you wouldn't know that you were almost cheated. So there is little risk to a thief to keep doing this race attack until successful.
To prevent that, use the proper "merchant configuration" on your node -- which is to not allow incoming transactions (specifically -nolisten) and have it explicitly connect to a well-connected node. There still is a small chance that you could be cheated though due to this race attack, and also a small chance of losing due to a Finney attack which the "merchant" configuration doesn't even protect you against.
Here's the double spending article on the Bitcoin wiki:
-
http://en.bitcoin.it/wiki/Double-spendingThat being said, there have been no reports to-date of anyone losing funds due to an in-person trade where a double spend occurred. It is much easier to operate a scam that defrauds the gullible than it is to execute a race attack that requires near perfect execution and a failure rate high enough that it will, over time, remain unprofitable.