Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
F
ffworker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Video AG Infrastruktur
ffworker
Commits
cbecc66c
Commit
cbecc66c
authored
Dec 05, 2017
by
Julian Rother
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
publish_video: Fixed path sanitizing
parent
ca4d3423
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
publish_video.c
publish_video.c
+3
-3
util/buildpath.c
util/buildpath.c
+2
-2
No files found.
publish_video.c
View file @
cbecc66c
...
...
@@ -15,11 +15,11 @@ int main(int argc, char *argv[])
jobid
=
atoi
(
argv
[
1
]);
ping_job
(
jobid
,
"running"
,
0
);
src
=
buildpath
(
getenv
(
WORKER_TMP
),
jstr
(
jlookup
(
argv
[
4
],
"source"
),
0
));
dest
=
buildpath
(
getenv
(
WORKER_RELEASED
),
jstr
(
jlookup
(
argv
[
4
],
"path"
),
0
));
destdir
=
dirname
(
mprintf
(
"%s/%s"
,
getenv
(
WORKER_RELEASED
),
jstr
(
jlookup
(
argv
[
4
],
"path"
),
""
)));
overwrite_check
(
dest
,
0
,
0
);
destdir
=
buildpath
(
getenv
(
WORKER_RELEASED
),
dirname
(
jstr
(
jlookup
(
argv
[
4
],
"path"
),
0
)));
if
(
mkdir
(
destdir
,
02775
)
&&
errno
!=
EEXIST
)
job_failed
(
"Could not create target directory
\"
%s
\"
: %s"
,
destdir
,
strerror
(
errno
));
dest
=
buildpath
(
getenv
(
WORKER_RELEASED
),
jstr
(
jlookup
(
argv
[
4
],
"path"
),
0
));
overwrite_check
(
dest
,
0
,
0
);
if
(
rename
(
src
,
dest
))
job_failed
(
"Overwriting target file failed: %s"
,
strerror
(
errno
));
ping_job
(
jobid
,
"finished"
,
"{%s,
\"
log
\"
:
\"
%s
\"
}"
,
...
...
util/buildpath.c
View file @
cbecc66c
...
...
@@ -8,10 +8,10 @@ char *buildpath(char *root, char *path)
if
(
!
path
)
job_failed
(
"Cannot build path: Value is empty"
);
if
(
!
(
root
=
realpath
(
root
,
0
)))
exit
(
99
);
job_failed
(
"Building path failed: %s"
,
strerror
(
errno
)
);
tmp
=
mprintf
(
"%s/%s"
,
root
,
path
);
if
(
!
(
path
=
realpath
(
tmp
,
0
)))
exit
(
99
);
job_failed
(
"Building path failed: %s"
,
strerror
(
errno
)
);
free
(
tmp
);
if
(
strncmp
(
root
,
path
,
strlen
(
root
)))
job_failed
(
"Cannot build path: Path points out of root directory"
);
...
...
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