kuebk/node — comment on commit 56079f72d742dba5bbc6e3983ab608ff0bbeb7f0
File: src/platform_linux.cc line 83
By bnoordhuis:

You don't need to strlen() the individual argv and environ elements since they're located in a single chunk of memory. This should be all you need:

```c
size_t size;
char* p;
char* q;
int i;

for (i = 0; environ[i]; ++i);

if (i)
p = environ[i - 1];
else
p = argv[argc - 1]; // assert(argc > 0);

size = p + strlen(p) - argv[0];

if ((q = malloc(size)))
memcpy(q, argv[0], size);
```