While trying to reverse engineer a "crackme" binary, I stumbled upon a function that starts like this:
mov ecx, [esp+4]
test ecx, 3
jz short loc_106A9F0
The first argument for the function (which is MOV
'd to ECX
in the first line of the function) is a pointer to a string. If I understand correctly, the next line performs the TEST
operation with one operand being a memory address and the other being a constant. I was wondering why a program might do that, considering the fact that the memory address itself should be irrelevant.
In short, I'm wondering why would a program TEST
a pointer with a non-zero const.