我是否需要在程序集中复制命令行参数
Do I need to copy command line arguments in assembly
我使用 fasm,但也许这个问题不依赖于汇编语言版本。命令行参数字符串存储在哪里?我是否需要在程序启动时复制此字符串,还是保证它会无限期保留?我的程序中的缓冲区溢出等是否可以覆盖原始程序?
命令行参数是 process environment block (PEB) and do not change after the process starts. You can access the command line via GetCommandLineW
, and you can parse the arguments yourself. There also exists CommandLineToArgvW
的一部分,它为您做一些解析。
字符串数据在可写内存中,所以是的,如果您有修改一个 arg 的错误/不安全代码,其中的溢出可能会修改另一个。
我使用 fasm,但也许这个问题不依赖于汇编语言版本。命令行参数字符串存储在哪里?我是否需要在程序启动时复制此字符串,还是保证它会无限期保留?我的程序中的缓冲区溢出等是否可以覆盖原始程序?
命令行参数是 process environment block (PEB) and do not change after the process starts. You can access the command line via GetCommandLineW
, and you can parse the arguments yourself. There also exists CommandLineToArgvW
的一部分,它为您做一些解析。
字符串数据在可写内存中,所以是的,如果您有修改一个 arg 的错误/不安全代码,其中的溢出可能会修改另一个。