https://bugs.winehq.org/show_bug.cgi?id=45320
--- Comment #16 from Dima Ryazanov dima@gmail.com --- Well, FWIW, in Windows 10, the contents of _environ does follow that format.
Here's my test code:
#include <stdio.h> #include <stdlib.h> #include <string.h>
int main() { char **e;
getenv(""); for (e = _environ; *e != NULL; e++) { printf("%p - %p\n", *e, *e + strlen(*e)); } printf("%p\n", e); return 0; }
I ran it with minimal environment, using the test.c I attached earlier.
Windows 10:
0000000000BE14A0 - 0000000000BE14A3 0000000000BE14A4 - 0000000000BE14AD 0000000000BE14AE - 0000000000BE14B1 0000000000BE1498
Wine (with the patch):
0000000000011908 - 000000000001190B 0000000000011916 - 000000000001191F 0000000000011920 - 0000000000011923 0000000000011924 - 0000000000011941 0000000000011942 - 000000000001195F 0000000000011960 - 0000000000011990 0000000000011991 - 00000000000119C1 00000000000118F8
You can see that in Windows 10, the data starts after 8 bytes (i.e., right after the NULL pointer), and there are no gaps between the env strings.