Skip to content

Commit 1d878c2

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

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

trunk/doc/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The changelog for SRS.
88

99
## SRS 6.0 Changelog
1010

11+
* v6.0, 2023-06-05, Fix command injection in demonstration api-server for HTTP callback. v6.0.48
1112
* v6.0, 2023-06-05, Merge [#3565](https://github.com/ossrs/srs/pull/3565): DTLS: Use bio callback to get fragment packet. v6.0.47 (#3565)
1213
* v6.0, 2023-05-29, Merge [#3513](https://github.com/ossrs/srs/pull/3513): SSL: Fix SSL_get_error get the error of other coroutine. v6.0.46 (#3513)
1314
* v6.0, 2023-05-14, Merge [#3534](https://github.com/ossrs/srs/pull/3534): Replace sprintf with snprintf to eliminate compile warnings. v6.0.45 (#3534)
@@ -61,6 +62,7 @@ The changelog for SRS.
6162

6263
## SRS 5.0 Changelog
6364

65+
* v5.0, 2023-06-05, Fix command injection in demonstration api-server for HTTP callback. v5.0.157
6466
* 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)
6567
* 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)
6668
* v5.0, 2023-05-13, Merge [#3541](https://github.com/ossrs/srs/pull/3541): asan: Fix memory leak in asan by releasing global IPs when run_directly_or_daemon fails. v5.0.154 (#3541)

trunk/research/api-server/server.go

+11-3
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

+1-1
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

trunk/src/core/srs_core_version6.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
#define VERSION_MAJOR 6
1111
#define VERSION_MINOR 0
12-
#define VERSION_REVISION 47
12+
#define VERSION_REVISION 48
1313

1414
#endif

0 commit comments

Comments
 (0)