Compilation error: stray ‘\302’ in program etc

后端 未结 13 2175
眼角桃花
眼角桃花 2020-12-01 14:03

I am having problem compiling the followed exploit code:

http://downloads.securityfocus.com/vulnerabilities/exploits/59846-1.c

I am using: \"gcc file.c\" and

13条回答
  •  臣服心动
    2020-12-01 14:22

    Sure, convert the file to ascii and blast all unicode characters away. It will probably work.... BUT...

    1. You won't know what you fixed.
    2. It will also destroy any unicode comments. Ex: //: A²+B²=C²
    3. It could potentially damage obvious logic, the code will still be broken, but the solution less obvious. For example: A string with "Smart-Quotes" (“ & ”) or a pointer with a full-width astrix ( * ). Now “SOME_THING” looks like a #define ( SOME_THING ) and *SomeType is the wrong type ( SomeType ).

    Two more sugrical approaches to fixing the problem:

    1. Switch fonts to see the character. (It might be invisible in your current font)
    2. Regex search all unicode characters not part non-extended ascii. In notepad++ I can search up to FFFF, which hasn't failed me yet.

      [\x{80}-\x{FFFF}]

      80 is hex for 128, the first extended ascii character.

      After hitting "find next" and highlighting what appears to be empty space, you can close your search dialog and press CTRL+C to copy to clipboard.

      Then paste the character into a unicode search tool. I usually use an online one. http://unicode.scarfboy.com/

    Example: I had a bullet point (•) in my code somehow. The unicode value is 2022 (hex), but when read as ascii by the compiler you get \342 \200 \242 (3 octal values). It's not as simple as converting each octal values to hex and smashing them together. So "E2 80 A2" is NOT the hex unicode point in your code.

提交回复
热议问题