Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b35d86aa
Commit
b35d86aa
authored
Nov 23, 2001
by
Uwe Bonnes
Committed by
Alexandre Julliard
Nov 23, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MSVCRT_getenv: compare for the length of the key and return NULL in
case of failure.
parent
dc3fa49b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
21 deletions
+24
-21
environ.c
dlls/msvcrt/environ.c
+24
-21
No files found.
dlls/msvcrt/environ.c
View file @
b35d86aa
...
...
@@ -21,22 +21,23 @@ char *MSVCRT_getenv(const char *name)
{
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
;
pos
=
strchr
(
pp
,
'='
);
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
;
}
...
...
@@ -48,24 +49,26 @@ WCHAR *_wgetenv(const WCHAR *name)
{
WCHAR
*
environ
=
GetEnvironmentStringsW
();
WCHAR
*
pp
,
*
pos
=
NULL
;
unsigned
int
length
;
unsigned
int
length
=
strlenW
(
name
)
;
for
(
pp
=
environ
;
(
*
pp
);
pp
=
pp
+
strlenW
(
pp
)
+
1
)
{
pos
=
strrchrW
(
pp
,
'='
);
if
(
pos
)
length
=
pos
-
pp
;
else
length
=
strlenW
(
pp
);
if
(
!
strncmpW
(
pp
,
name
,
length
))
break
;
}
if
((
pp
)
&&
(
pos
))
{
pp
=
pos
+
1
;
TRACE
(
"got %s
\n
"
,
debugstr_w
(
pp
));
pos
=
strchrW
(
pp
,
'='
);
if
((
pos
)
&&
((
pos
-
pp
)
==
length
))
{
if
(
!
strncmpW
(
pp
,
name
,
length
))
{
pp
=
pos
+
1
;
TRACE
(
"got %s
\n
"
,
debugstr_w
(
pp
));
/* can't free pointer since we are returning it */
/* should probably use MSVCRT_wenviron instead */
FIXME
(
"memory leak
\n
"
);
return
pp
;
}
}
}
FreeEnvironmentStringsW
(
environ
);
return
pp
;
return
NULL
;
}
/*********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment