[ create a new paste ] login | about

Link: http://codepad.org/9IcNMhYZ    [ raw code | output | fork ]

C, pasted on Oct 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
main() 
{     
    printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);
    // unix = 1
    // 1[x] is the same as x[1]: http://en.wikipedia.org/wiki/Index_notation#C_implementation_details    

    char* original_fmt = "\021%six\n";   // \012 is the newline
    char* fmt = &original_fmt[unix];     // fmt = "%six\n"

    int offset = "have"[unix] - 0x60;    // 'a' = 0x61. So offset is 1.
    char* original_args = "fun";
    char* args = original_args + offset; // args = "un"

    printf(fmt, args);
}


Output:
1
2
3
4
unix
unix

Exited: ExitFailure 5


Create a new paste based on this one


Comments: