QWXFB-2024/热身赛/use_gdb/use_gdb.c
2024-09-16 11:35:04 +08:00

27 lines
563 B
C

#include <stdio.h>
// test_your_gdb
// flag{te5t_y0ur_9db}
void reverse(char *buf) {
for(int i = 0; i < 4; ++i) {
char tmp = buf[i];
buf[i] = buf[7-i];
buf[7-i] = tmp;
}
}
int main() {
char buf[0x20];
long long x = 0x666c61677b746535;
long long y = 0x745f793075725f39;
long long z = 0x64627d;
*(long long *) buf = x;
*(long long *) (buf+8) = y;
*(long long *) (buf+16) = z;
reverse(buf);
reverse(buf+8);
char tmp = buf[16];
buf[16] = buf[18];
buf[18] = tmp;
return x + y + z;
}