about summary refs log tree commit diff
path: root/qbdi_mode/demo-so.c
diff options
context:
space:
mode:
Diffstat (limited to 'qbdi_mode/demo-so.c')
-rwxr-xr-xqbdi_mode/demo-so.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/qbdi_mode/demo-so.c b/qbdi_mode/demo-so.c
new file mode 100755
index 00000000..1820ea2f
--- /dev/null
+++ b/qbdi_mode/demo-so.c
@@ -0,0 +1,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;

+}

+

+

+