(no subject)

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Nov 20 15:14:17 CST 2001


Changelog:
	dlls/msvcrt/environ.c: MSVCRT_getenv
	Compare for the length of the key and return NULL in case of failure

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/environ.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/environ.c,v
retrieving revision 1.4
diff -u -r1.4 environ.c
--- wine/dlls/msvcrt/environ.c	2001/04/10 23:25:25	1.4
+++ wine/dlls/msvcrt/environ.c	2001/11/20 19:41:20
@@ -21,22 +21,21 @@
 {
   char *environ = GetEnvironmentStringsA();
   char *pp,*pos = NULL;
-  unsigned int length;
+  unsigned int length=strlen(name);
 
   for (pp = environ; (*pp); pp = pp + strlen(pp) +1)
   {
     pos =strchr(pp,'=');
-    if (pos)
-      length = pos -pp;
-    else
-      length = strlen(pp);
-    if (!strncmp(pp,name,length)) break;
+    if ((pos) && ((pos -pp)== length))
+      if (!strncmp(pp,name,length)) break;
   }
-  if ((pp)&& (pos))
+  if ((*pp)&& (pos))
   {
      pp = pos+1;
      TRACE("got %s\n",pp);
   }
+  else
+    pp = 0;
   FreeEnvironmentStringsA( environ );
   return pp;
 }




More information about the wine-patches mailing list