Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b9b16620
Commit
b9b16620
authored
Apr 27, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd_RedirectNew: avoid strdup() with unhandled error
parent
00f0bdcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
src/network/httpd.c
src/network/httpd.c
+8
-7
No files found.
src/network/httpd.c
View file @
b9b16620
...
...
@@ -525,7 +525,7 @@ httpd_handler_sys_t *httpd_HandlerDelete(httpd_handler_t *handler)
struct
httpd_redirect_t
{
httpd_url_t
*
url
;
char
*
psz_dst
;
char
dst
[
1
]
;
};
static
int
httpd_RedirectCallBack
(
httpd_callback_sys_t
*
p_sys
,
...
...
@@ -544,11 +544,11 @@ static int httpd_RedirectCallBack(httpd_callback_sys_t *p_sys,
answer
->
i_type
=
HTTPD_MSG_ANSWER
;
answer
->
i_status
=
301
;
answer
->
i_body
=
httpd_HtmlError
(
&
p_body
,
301
,
rdir
->
psz_
dst
);
answer
->
i_body
=
httpd_HtmlError
(
&
p_body
,
301
,
rdir
->
dst
);
answer
->
p_body
=
(
unsigned
char
*
)
p_body
;
/* XXX check if it's ok or we need to set an absolute url */
httpd_MsgAdd
(
answer
,
"Location"
,
"%s"
,
rdir
->
psz_
dst
);
httpd_MsgAdd
(
answer
,
"Location"
,
"%s"
,
rdir
->
dst
);
httpd_MsgAdd
(
answer
,
"Content-Length"
,
"%d"
,
answer
->
i_body
);
...
...
@@ -558,8 +558,10 @@ static int httpd_RedirectCallBack(httpd_callback_sys_t *p_sys,
httpd_redirect_t
*
httpd_RedirectNew
(
httpd_host_t
*
host
,
const
char
*
psz_url_dst
,
const
char
*
psz_url_src
)
{
httpd_redirect_t
*
rdir
=
malloc
(
sizeof
(
*
rdir
));
if
(
!
rdir
)
size_t
dstlen
=
strlen
(
psz_url_dst
);
httpd_redirect_t
*
rdir
=
malloc
(
sizeof
(
*
rdir
)
+
dstlen
);
if
(
unlikely
(
rdir
==
NULL
))
return
NULL
;
rdir
->
url
=
httpd_UrlNew
(
host
,
psz_url_src
,
NULL
,
NULL
);
...
...
@@ -567,7 +569,7 @@ httpd_redirect_t *httpd_RedirectNew(httpd_host_t *host, const char *psz_url_dst,
free
(
rdir
);
return
NULL
;
}
rdir
->
psz_dst
=
strdup
(
psz_url_dst
);
memcpy
(
rdir
->
dst
,
psz_url_dst
,
dstlen
+
1
);
/* Redirect apply for all HTTP request and RTSP DESCRIBE resquest */
httpd_UrlCatch
(
rdir
->
url
,
HTTPD_MSG_HEAD
,
httpd_RedirectCallBack
,
...
...
@@ -584,7 +586,6 @@ httpd_redirect_t *httpd_RedirectNew(httpd_host_t *host, const char *psz_url_dst,
void
httpd_RedirectDelete
(
httpd_redirect_t
*
rdir
)
{
httpd_UrlDelete
(
rdir
->
url
);
free
(
rdir
->
psz_dst
);
free
(
rdir
);
}
...
...
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