about summary refs log tree commit diff
path: root/qbdi_mode/demo-so.c
blob: 1820ea2f1c462c76b42d4206ddbe91d0fc646606 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>



// gcc -shared -o libdemo.so demo-so.c -w


int target_func(char* buf, int size){
    
    printf("buffer:%p, size:%p\n", buf, size);

    switch (buf[0])
    {
    case 1:
        puts("222");
        if(buf[1]=='\x44'){
            puts("xxxiiii");
        }
        break;
    case '\xfe':
        // assert(0);
        if(buf[4]=='\xf0'){
            puts("xxxiiii");
        }
        break;
    case 0xff:
        if(buf[2]=='\xff'){
            if(buf[1]=='\x44'){
                puts("xxxiiii");
                assert(0);
            }else{
                puts("xxxiiii");
            }
        }
        puts("xxxx");
        break;
    default:
        puts("xxxxxxx");
        break;
    }

    return 1;
}