Skip to content

Commit 1e43bb6

Browse files
panda1986winlinvip
authored andcommitted
Fix command injection in api-server for HTTP callback. v5.0.157, v6.0.48
1 parent 1545425 commit 1e43bb6

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

trunk/doc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The changelog for SRS.
88

99
## SRS 5.0 Changelog
1010

11+
* v5.0, 2023-06-05, Fix command injection in demonstration api-server for HTTP callback. v5.0.157
1112
* v5.0, 2023-06-05, Merge [#3565](https://github.com/ossrs/srs/pull/3565): DTLS: Use bio callback to get fragment packet. v5.0.156 (#3565)
1213
* v5.0, 2023-05-29, Merge [#3513](https://github.com/ossrs/srs/pull/3513): SSL: Fix SSL_get_error get the error of other coroutine. v5.0.155 (#3513)
1314
* v5.0, 2023-05-14, Support the publishing of RTP plaintext packets using WHIP. v5.0.155

trunk/research/api-server/server.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,18 @@ func (v *SnapshotJob) do(ffmpegPath, inputUrl string) (err error) {
400400
normalPicPath := path.Join(outputPicDir, fmt.Sprintf("%v", v.Stream)+"-%03d.png")
401401
bestPng := path.Join(outputPicDir, fmt.Sprintf("%v-best.png", v.Stream))
402402

403-
param := fmt.Sprintf("%v -i %v -vf fps=1 -vcodec png -f image2 -an -y -vframes %v -y %v", ffmpegPath, inputUrl, v.vframes, normalPicPath)
404-
log.Println(fmt.Sprintf("start snapshot, cmd param=%v", param))
403+
params := []string{
404+
"-i", inputUrl,
405+
"-vf", "fps=1",
406+
"-vcodec", "png",
407+
"-f", "image2",
408+
"-an",
409+
"-vframes", strconv.Itoa(v.vframes),
410+
"-y", normalPicPath,
411+
}
412+
log.Println(fmt.Sprintf("start snapshot, cmd param=%v %v", ffmpegPath, strings.Join(params, " ")))
405413
timeoutCtx, _ := context.WithTimeout(v.cancelCtx, v.timeout)
406-
cmd := exec.CommandContext(timeoutCtx, "/bin/bash", "-c", param)
414+
cmd := exec.CommandContext(timeoutCtx, ffmpegPath, params...)
407415
if err = cmd.Run(); err != nil {
408416
log.Println(fmt.Sprintf("run snapshot %v cmd failed, err is %v", v.Tag(), err))
409417
return

trunk/src/core/srs_core_version5.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
#define VERSION_MAJOR 5
1111
#define VERSION_MINOR 0
12-
#define VERSION_REVISION 156
12+
#define VERSION_REVISION 157
1313

1414
#endif

0 commit comments

Comments
 (0)