質問編集履歴

1

追記

2017/05/13 15:45

投稿

strike1217
strike1217

スコア651

test CHANGED
File without changes
test CHANGED
@@ -103,3 +103,83 @@
103
103
  どなたか教えてください。
104
104
 
105
105
  Linux 64bit です。
106
+
107
+
108
+
109
+
110
+
111
+ 「追記」
112
+
113
+ ```C
114
+
115
+ #include<stdio.h>
116
+
117
+ #include<string.h>
118
+
119
+ #include<stdlib.h>
120
+
121
+
122
+
123
+ int main(int argc, char* argv[]){
124
+
125
+ int i;
126
+
127
+ int x[20];
128
+
129
+ char text[1024];
130
+
131
+ strcpy(text, argv[1]);
132
+
133
+
134
+
135
+ for(i = 0; i < 20; i++)
136
+
137
+ x[i] = i;
138
+
139
+
140
+
141
+ printf(text);
142
+
143
+ printf("\n%p, %p, %p, %p, %p, %p\n", &i, &x[0], &x[1], &x[2], &x[3], &x[4]);
144
+
145
+ return 0;
146
+
147
+ }
148
+
149
+
150
+
151
+ ```
152
+
153
+ ```ここに言語を入力
154
+
155
+ ./stack_overflow %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x > stack_overflow.txt
156
+
157
+
158
+
159
+ cat stack_overflow.txt
160
+
161
+
162
+
163
+ b055bae0,13,252c7825,18f5c840,b4ebda50,b055b138,b055ac78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,252c7825,2c78252c,78252c78,b50cfd58,1,0,1,b50d29d8,0,5e400000,0,b50d34c0,b055ad50,18f5c391,b50d29d8,b055ad40,b4eae740,3de00ec7,ffffffff,b4b2f7f0,b4b16b98,b50cf4c0,b4b10000,398020,b055af20,b4c2f6e5,0,0,0,b056d1d8,0,0,0,b4eaea20,b50d29d8,b4eb7124,7,8,b50d3700,b056d1a8,b056d298
164
+
165
+ 0x7ffcb055b04c, 0x7ffcb055aff0, 0x7ffcb055aff4, 0x7ffcb055aff8, 0x7ffcb055affc, 0x7ffcb055b000
166
+
167
+
168
+
169
+ ```
170
+
171
+ となったときに、
172
+
173
+ おそらく、b055bae0,13,252c7825,18f5c840,b4ebda50,b055b138,b055ac78
174
+
175
+ の部分に int i ~ int x[5] の値が含まれているはずです。
176
+
177
+ それがどれなのかをみつけたいのです。
178
+
179
+
180
+
181
+ ちなみに、大部分は以下のようなコードがが占めています。
182
+
183
+ printf "\x25\x78\x2c\n"
184
+
185
+ %x,