インジェクションとは・・
"「インジェクション」(injection)とは「注入」という意味"
by e-Words
- 入力された文字エンコーディングの検証
- 期待していない効果のある文字列が含まれていないかの検証
| #include <stdio.h> | |
| int main() | |
| { | |
| char str_a[20]; | |
| str_a[0] = 'H'; | |
| str_a[1] = 'e'; | |
| str_a[2] = 'l'; | |
| str_a[3] = 'l'; | |
| str_a[4] = 'o'; | |
| str_a[5] = ','; |
| #include <stdio.h> | |
| int main() | |
| { | |
| char str_a[20]; | |
| str_a[0] = 'H'; | |
| str_a[1] = 'e'; | |
| str_a[2] = 'l'; | |
| str_a[3] = 'l'; | |
| str_a[4] = 'o'; | |
| str_a[5] = 0; |
| #include <stdio.h> | |
| #include <string.h> | |
| int main() { | |
| char str_a[20]; | |
| char *pointer; | |
| char *pointer2; | |
| strcpy(str_a, "Hello, world!\n"); | |
| pointer = str_a; |
| (gdb) list | |
| 1 #include <stdio.h> | |
| 2 #include <string.h> | |
| 3 | |
| 4 int main() { | |
| 5 char str_a[20]; | |
| 6 char *pointer; | |
| 7 char *pointer2; | |
| 8 | |
| 9 strcpy(str_a, "Hello, world!\n"); |
| #include <stdio.h> | |
| int main() { | |
| int int_var = 5; | |
| int *int_ptr; | |
| int_ptr = &int_var; // int_varのアドレスをint_ptrに設定する | |
| } |
| % gdb -q ./a.out | |
| Reading symbols for shared libraries .. done | |
| (gdb) list | |
| 1 #include <stdio.h> | |
| 2 | |
| 3 int main() { | |
| 4 int int_var = 5; | |
| 5 int *int_ptr; | |
| 6 | |
| 7 int_ptr = &int_var; // int_varのアドレスをint_ptrに設定する |
| #include <stdio.h> | |
| int main() { | |
| char string[10]; | |
| int NUM1 = -10; | |
| unsigned int NUM2 = 100; | |
| strcpy(string, "hogeee"); | |
| // anything format ext |
| #include <stdio.h> | |
| int main() { | |
| char string[10]; | |
| int NUM1 = -10; | |
| unsigned int NUM2 = 1000; | |
| strcpy(string, "hogeee"); | |
| printf("[NUM2のフィールド幅指定] 3: '%3u', 10: '%10u', 08: '%08u'\n", NUM2, NUM2, NUM2); |
インジェクションとは・・
"「インジェクション」(injection)とは「注入」という意味"
by e-Words