4 ms·
Or chaining it even further for copying a null-terminated string. The assignment operator returns the same value that was just stored, so it can be used as the
by MereInterest 4y ago
Or chaining it even further for copying a null-terminated string. The assignment operator returns the same value that was just stored, so it can be used as the conditional on a while loop.
while(*dst++ = *src++);
Incredibly succinct, ridiculous powerful, and way too easy to overrun array bounds.
- Annatar 4y agoYep, if there is no #$00 ('\0') at the end of the string, an exploit will ensue, especially if the attacker manages to modify the string first.