哪位高手帮小弟我详细地讲解一下这段代码的汇编指令的意思,小弟我汇编还在学习中,很菜。
谁帮我详细地讲解一下这段代码的汇编指令的意思,我汇编还在学习中,很菜。。。
如题:
11: _snprintf(cBuf, MAX_LEN, "%d: %s", nPid, cBuf); /* cBuf既是源又是目标,函数使用不安全 */
0040D770 lea ecx,[ebp-404h]
0040D776 push ecx
0040D777 mov edx,dword ptr [ebp-408h]
0040D77D push edx
0040D77E push offset string "sizeof(a):%d\n" (0042201c)
0040D783 push 400h
0040D788 lea eax,[ebp-404h]
0040D78E push eax
0040D78F call _snprintf (00406f20)
0040D794 add esp,14h
------解决方案--------------------
如题:
11: _snprintf(cBuf, MAX_LEN, "%d: %s", nPid, cBuf); /* cBuf既是源又是目标,函数使用不安全 */
0040D770 lea ecx,[ebp-404h]
0040D776 push ecx
0040D777 mov edx,dword ptr [ebp-408h]
0040D77D push edx
0040D77E push offset string "sizeof(a):%d\n" (0042201c)
0040D783 push 400h
0040D788 lea eax,[ebp-404h]
0040D78E push eax
0040D78F call _snprintf (00406f20)
0040D794 add esp,14h
------解决方案--------------------
_snprintf(cBuf, MAX_LEN, "%d: %s", nPid, cBuf); /* cBuf既是源又是目标,函数使用不安全 */
0040D770 lea ecx,[ebp-404h]//cBuf的地址
0040D776 push ecx //cBuf的地址入栈
0040D777 mov edx,dword ptr [ebp-408h]
0040D77D push edx//nPid入栈
0040D77E push offset string "sizeof(a):%d\n" (0042201c) //"%d: %s"地址入栈
0040D783 push 400h//MAX_LEN入栈
0040D788 lea eax,[ebp-404h]
0040D78E push eax//cbuf入栈
0040D78F call _snprintf (00406f20)//调用函数
0040D794 add esp,14h//出栈