Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
9753c6be
Commit
9753c6be
authored
13 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
ftp.c: ftplistparser related OOM handling fix
parent
b16e3da1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ftp.c
+19
-7
19 additions, 7 deletions
lib/ftp.c
with
19 additions
and
7 deletions
lib/ftp.c
+
19
−
7
View file @
9753c6be
...
...
@@ -3824,15 +3824,17 @@ static CURLcode init_wc_data(struct connectdata *conn)
resources for wildcard transfer */
/* allocate ftp protocol specific temporary wildcard data */
ftp_tmp
=
m
alloc
(
sizeof
(
struct
ftp_wc_tmpdata
));
ftp_tmp
=
c
alloc
(
1
,
sizeof
(
struct
ftp_wc_tmpdata
));
if
(
!
ftp_tmp
)
{
Curl_safefree
(
wildcard
->
pattern
);
return
CURLE_OUT_OF_MEMORY
;
}
/* INITIALIZE parselist structure */
ftp_tmp
->
parser
=
Curl_ftp_parselist_data_alloc
();
if
(
!
ftp_tmp
->
parser
)
{
free
(
ftp_tmp
);
Curl_safefree
(
wildcard
->
pattern
);
Curl_safefree
(
ftp_tmp
);
return
CURLE_OUT_OF_MEMORY
;
}
...
...
@@ -3846,9 +3848,22 @@ static CURLcode init_wc_data(struct connectdata *conn)
/* try to parse ftp url */
ret
=
ftp_parse_url_path
(
conn
);
if
(
ret
)
{
Curl_safefree
(
wildcard
->
pattern
);
wildcard
->
tmp_dtor
(
wildcard
->
tmp
);
wildcard
->
tmp_dtor
=
ZERO_NULL
;
wildcard
->
tmp
=
NULL
;
return
ret
;
}
wildcard
->
path
=
strdup
(
conn
->
data
->
state
.
path
);
if
(
!
wildcard
->
path
)
{
Curl_safefree
(
wildcard
->
pattern
);
wildcard
->
tmp_dtor
(
wildcard
->
tmp
);
wildcard
->
tmp_dtor
=
ZERO_NULL
;
wildcard
->
tmp
=
NULL
;
return
CURLE_OUT_OF_MEMORY
;
}
/* backup old write_function */
ftp_tmp
->
backup
.
write_function
=
conn
->
data
->
set
.
fwrite_func
;
/* parsing write function */
...
...
@@ -3858,11 +3873,6 @@ static CURLcode init_wc_data(struct connectdata *conn)
/* let the writefunc callback know what curl pointer is working with */
conn
->
data
->
set
.
out
=
conn
;
wildcard
->
path
=
strdup
(
conn
->
data
->
state
.
path
);
if
(
!
wildcard
->
path
)
{
return
CURLE_OUT_OF_MEMORY
;
}
infof
(
conn
->
data
,
"Wildcard - Parsing started
\n
"
);
return
CURLE_OK
;
}
...
...
@@ -3889,6 +3899,8 @@ static CURLcode wc_statemach(struct connectdata *conn)
struct
ftp_wc_tmpdata
*
ftp_tmp
=
wildcard
->
tmp
;
conn
->
data
->
set
.
fwrite_func
=
ftp_tmp
->
backup
.
write_function
;
conn
->
data
->
set
.
out
=
ftp_tmp
->
backup
.
file_descriptor
;
ftp_tmp
->
backup
.
write_function
=
ZERO_NULL
;
ftp_tmp
->
backup
.
file_descriptor
=
NULL
;
wildcard
->
state
=
CURLWC_DOWNLOADING
;
if
(
Curl_ftp_parselist_geterror
(
ftp_tmp
->
parser
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment