Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
36e833c3
Commit
36e833c3
authored
Oct 01, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use asprintf instead of malloc/sprintf.
parent
58208c69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
27 deletions
+13
-27
modules/control/http/http.c
modules/control/http/http.c
+13
-27
No files found.
modules/control/http/http.c
View file @
36e833c3
...
...
@@ -597,41 +597,33 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
if
(
i_request
)
{
psz_tmp
=
malloc
(
sizeof
(
"QUERY_STRING="
)
+
i_request
);
sprintf
(
psz_tmp
,
"QUERY_STRING=%s"
,
p_request
);
asprintf
(
&
psz_tmp
,
"QUERY_STRING=%s"
,
p_request
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
psz_tmp
=
malloc
(
sizeof
(
"REQUEST_URI=?"
)
+
strlen
(
p_url
)
+
i_request
);
sprintf
(
psz_tmp
,
"REQUEST_URI=%s?%s"
,
p_url
,
p_request
);
asprintf
(
&
psz_tmp
,
"REQUEST_URI=%s?%s"
,
p_url
,
p_request
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
else
{
psz_tmp
=
malloc
(
sizeof
(
"REQUEST_URI="
)
+
strlen
(
p_url
)
);
sprintf
(
psz_tmp
,
"REQUEST_URI=%s"
,
p_url
);
asprintf
(
&
psz_tmp
,
"REQUEST_URI=%s"
,
p_url
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
psz_tmp
=
malloc
(
sizeof
(
"SCRIPT_NAME="
)
+
strlen
(
p_url
)
);
sprintf
(
psz_tmp
,
"SCRIPT_NAME=%s"
,
p_url
);
asprintf
(
psz_tmp
,
"SCRIPT_NAME=%s"
,
p_url
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
#define p_sys p_args->file.p_intf->p_sys
psz_tmp
=
malloc
(
sizeof
(
"SERVER_NAME="
)
+
strlen
(
p_sys
->
psz_address
)
);
sprintf
(
psz_tmp
,
"SERVER_NAME=%s"
,
p_sys
->
psz_address
);
asprintf
(
&
psz_tmp
,
"SERVER_NAME=%s"
,
p_sys
->
psz_address
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
psz_tmp
=
malloc
(
sizeof
(
"SERVER_PORT="
)
+
5
);
sprintf
(
psz_tmp
,
"SERVER_PORT=%u"
,
p_sys
->
i_port
);
asprintf
(
&
psz_tmp
,
"SERVER_PORT=%u"
,
p_sys
->
i_port
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
#undef p_sys
p
=
getenv
(
"PATH"
);
if
(
p
!=
NULL
)
{
psz_tmp
=
malloc
(
sizeof
(
"PATH="
)
+
strlen
(
p
)
);
sprintf
(
psz_tmp
,
"PATH=%s"
,
p
);
asprintf
(
&
psz_tmp
,
"PATH=%s"
,
p
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
...
...
@@ -639,23 +631,20 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
p
=
getenv
(
"windir"
);
if
(
p
!=
NULL
)
{
psz_tmp
=
malloc
(
sizeof
(
"SYSTEMROOT="
)
+
strlen
(
p
)
);
sprintf
(
psz_tmp
,
"SYSTEMROOT=%s"
,
p
);
asprintf
(
&
psz_tmp
,
"SYSTEMROOT=%s"
,
p
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
#endif
if
(
psz_remote_addr
!=
NULL
&&
*
psz_remote_addr
)
{
psz_tmp
=
malloc
(
sizeof
(
"REMOTE_ADDR="
)
+
strlen
(
psz_remote_addr
)
);
sprintf
(
psz_tmp
,
"REMOTE_ADDR=%s"
,
psz_remote_addr
);
asprintf
(
&
psz_tmp
,
"REMOTE_ADDR=%s"
,
psz_remote_addr
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
if
(
psz_remote_host
!=
NULL
&&
*
psz_remote_host
)
{
psz_tmp
=
malloc
(
sizeof
(
"REMOTE_HOST="
)
+
strlen
(
psz_remote_host
)
);
sprintf
(
psz_tmp
,
"REMOTE_HOST=%s"
,
psz_remote_host
);
asprintf
(
&
psz_tmp
,
"REMOTE_HOST=%s"
,
psz_remote_host
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
}
...
...
@@ -670,8 +659,7 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
if
(
end
==
NULL
)
break
;
*
end
=
'\0'
;
psz_tmp
=
malloc
(
sizeof
(
"CONTENT_TYPE="
)
+
strlen
(
p
)
);
sprintf
(
psz_tmp
,
"CONTENT_TYPE=%s"
,
p
);
asprintf
(
&
psz_tmp
,
"CONTENT_TYPE=%s"
,
p
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
*
end
=
'\r'
;
}
...
...
@@ -682,8 +670,7 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
if
(
end
==
NULL
)
break
;
*
end
=
'\0'
;
psz_tmp
=
malloc
(
sizeof
(
"CONTENT_LENGTH="
)
+
strlen
(
p
)
);
sprintf
(
psz_tmp
,
"CONTENT_LENGTH=%s"
,
p
);
asprintf
(
&
psz_tmp
,
"CONTENT_LENGTH=%s"
,
p
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
*
end
=
'\r'
;
}
...
...
@@ -702,8 +689,7 @@ int HandlerCallback( httpd_handler_sys_t *p_args,
if
(
psz_file
!=
NULL
)
{
psz_file
++
;
psz_tmp
=
malloc
(
sizeof
(
"SCRIPT_FILENAME="
)
+
strlen
(
psz_file
)
);
sprintf
(
psz_tmp
,
"SCRIPT_FILENAME=%s"
,
psz_file
);
asprintf
(
&
psz_tmp
,
"SCRIPT_FILENAME=%s"
,
psz_file
);
TAB_APPEND
(
i_env
,
ppsz_env
,
psz_tmp
);
TAB_APPEND
(
p_args
->
p_association
->
i_argc
,
...
...
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