5 ms·
It's common enough, like in a typical memcpy implementation: while(size--) *dst++ = *src++;
by pubby 4y ago
It's common enough, like in a typical memcpy implementation:
while(size--)
*dst++ = *src++;
- deleted 4y ago[deleted]
- MereInterest 4y agoOr 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.
- Taniwha 4y agoIt's one place C shows its roots .... mov (r0)+, (r1)+ is a PDP11 instruction as is mov -(PC), -(PC)