execle() also specifies the environment. What does that mean?

北城余情 提交于 2019-12-04 10:03:33

What do they mean by specifying the environment?

The last argument passed to execle() is an array of char pointers, which contain C strings describing the environment variables the executed program will see. Here is an example.

What classifies different environments?

I don't quite get this one. Each program has its own set of environment variables, that's it.

Why is the address of the environment variable calculated that way (or more specifically why is the base address 0xbffffffa)?

Because the Linux kernel is implemented like so.

If I used the execl() function instead of the execle() could I not have used the shellcode environment variable?

execl() does not let you specify environment variables, if that's what you're interested in.

 int execle(const char *path, const char *arg0, ...
         /* const char *argn, (char *)0,char *const envp[]*/);

The envp[] array is a pointer to all of the UNIX environment variables for the process to be created. That defines the "environment" for the new process.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!