1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix security scan problems. v6.0.131 (#4100)

1. fix redundant null check, there is no potential risks by the way,
just redundant null check.
2. Potential use pointer after free, that's not true. So we can ignore
this one, or find a way to make stupid security tool happy.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
This commit is contained in:
Jacob Su 2024-06-21 15:59:15 +08:00 committed by GitHub
parent 1f9309ae25
commit ea7e2c2849
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 10 deletions

View file

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v6-changes"></a> <a name="v6-changes"></a>
## SRS 6.0 Changelog ## SRS 6.0 Changelog
* v6.0, 2024-06-21, Merge [#4100](https://github.com/ossrs/srs/pull/4100): Fix security scan problems. v6.0.131 (#4100)
* v6.0, 2024-06-21, Merge [#4097](https://github.com/ossrs/srs/pull/4097): SmartPtr: Support load test for source by srs-bench. v6.0.130 (#4097) * v6.0, 2024-06-21, Merge [#4097](https://github.com/ossrs/srs/pull/4097): SmartPtr: Support load test for source by srs-bench. v6.0.130 (#4097)
* v6.0, 2024-06-15, Merge [#4089](https://github.com/ossrs/srs/pull/4089): SmartPtr: Support shared ptr for live source. v6.0.129 (#4089) * v6.0, 2024-06-15, Merge [#4089](https://github.com/ossrs/srs/pull/4089): SmartPtr: Support shared ptr for live source. v6.0.129 (#4089)
* v6.0, 2024-06-14, Merge [#4085](https://github.com/ossrs/srs/pull/4085): SmartPtr: Support shared ptr for RTC source. v6.0.128 (#4085) * v6.0, 2024-06-14, Merge [#4085](https://github.com/ossrs/srs/pull/4085): SmartPtr: Support shared ptr for RTC source. v6.0.128 (#4085)

View file

@ -1204,12 +1204,10 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
} }
// use the handler if exists. // use the handler if exists.
if (ph) {
if (streamHandlers.find(sid) != streamHandlers.end()) { if (streamHandlers.find(sid) != streamHandlers.end()) {
entry = streamHandlers[sid]; entry = streamHandlers[sid];
*ph = entry->stream; *ph = entry->stream;
} }
}
// trigger edge to fetch from origin. // trigger edge to fetch from origin.
bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost); bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost);

View file

@ -199,15 +199,15 @@ void SrsFastVector::push_back(SrsSharedPtrMessage* msg)
// increase vector. // increase vector.
if (count >= nb_msgs) { if (count >= nb_msgs) {
int size = srs_max(SRS_PERF_MW_MSGS * 8, nb_msgs * 2); int size = srs_max(SRS_PERF_MW_MSGS * 8, nb_msgs * 2);
SrsSharedPtrMessage** buf = new SrsSharedPtrMessage*[size]; SrsSharedPtrMessage** buf = msgs;
msgs = new SrsSharedPtrMessage*[size];
for (int i = 0; i < nb_msgs; i++) { for (int i = 0; i < nb_msgs; i++) {
buf[i] = msgs[i]; msgs[i] = buf[i];
} }
srs_info("fast vector incrase %d=>%d", nb_msgs, size); srs_info("fast vector incrase %d=>%d", nb_msgs, size);
// use new array. // use new array.
srs_freepa(msgs); srs_freepa(buf);
msgs = buf;
nb_msgs = size; nb_msgs = size;
} }

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 6 #define VERSION_MAJOR 6
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 130 #define VERSION_REVISION 131
#endif #endif