Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4e1ff3a1
Commit
4e1ff3a1
authored
Apr 11, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect dangerous use of environment variables at run-time
parent
d8c9ed53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
bin/override.c
bin/override.c
+39
-0
No files found.
bin/override.c
View file @
4e1ff3a1
...
@@ -77,4 +77,43 @@ static void *getsym (const char *name)
...
@@ -77,4 +77,43 @@ static void *getsym (const char *name)
({ typeof (func) *sym = getsym ( # func); sym (__VA_ARGS__); })
({ typeof (func) *sym = getsym ( # func); sym (__VA_ARGS__); })
/*** Environment ***
*
* "Conforming multi-threaded applications shall not use the environ variable
* to access or modify any environment variable while any other thread is
* concurrently modifying any environment variable." -- POSIX.
*
* Some evil libraries modify the environment. We currently ignore the calls as
* they could crash the process. This may cause funny behaviour though. */
int
putenv
(
char
*
str
)
{
if
(
override
)
{
LOG
(
"Blocked"
,
"
\"
%s
\"
"
,
str
);
return
0
;
}
return
CALL
(
putenv
,
str
);
}
int
setenv
(
const
char
*
name
,
const
char
*
value
,
int
overwrite
)
{
if
(
override
)
{
LOG
(
"Blocked"
,
"
\"
%s
\"
,
\"
%s
\"
, %d"
,
name
,
value
,
overwrite
);
return
0
;
}
return
CALL
(
setenv
,
name
,
value
,
overwrite
);
}
int
unsetenv
(
const
char
*
name
)
{
if
(
override
)
{
LOG
(
"Blocked"
,
"
\"
%s
\"
"
,
name
);
return
0
;
}
return
CALL
(
unsetenv
,
name
);
}
#endif
/* __ELF__ */
#endif
/* __ELF__ */
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