[Bug 45320] cmd creates an environment variable with an empty name

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Sep 18 03:32:29 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=45320

--- Comment #16 from Dima Ryazanov <dima at 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.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list