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

Fix server id generator bug. v4.0.254

This commit is contained in:
winlin 2022-08-10 10:20:47 +08:00
parent 7b23a42139
commit febd45d514
3 changed files with 9 additions and 4 deletions

View file

@ -8,6 +8,7 @@ The changelog for SRS.
## SRS 4.0 Changelog ## SRS 4.0 Changelog
* v4.0, 2022-08-10, Fix server id generator bug. v4.0.254
* v4.0, 2022-06-29, Update SRS image for r.ossrs.net. v4.0.253 * v4.0, 2022-06-29, Update SRS image for r.ossrs.net. v4.0.253
* v4.0, 2022-06-11, For [#3058](https://github.com/ossrs/srs/pull/3058): Docker: Support x86_64, armv7 and aarch64 docker image (#3058). v4.0.252 * v4.0, 2022-06-11, For [#3058](https://github.com/ossrs/srs/pull/3058): Docker: Support x86_64, armv7 and aarch64 docker image (#3058). v4.0.252
* v4.0, 2022-03-19, For [#2893](https://github.com/ossrs/srs/pull/2893): SRT: Decouple publish with play url (#2893). v4.0.251 * v4.0, 2022-03-19, For [#2893](https://github.com/ossrs/srs/pull/2893): SRT: Decouple publish with play url (#2893). v4.0.251

View file

@ -193,11 +193,15 @@ srs_error_t SrsLatestVersion::start()
uuid_t uuid; uuid_t uuid;
uuid_generate_time(uuid); uuid_generate_time(uuid);
char buf[32]; // Must reserve last 1 byte for the trailing '\0', because we expect the size of uuid string is 32 bytes.
char buf[32 + 1];
srs_assert(16 == sizeof(uuid_t));
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
snprintf(buf + i * 2, sizeof(buf), "%02x", uuid[i]); int r0 = snprintf(buf + i * 2, sizeof(buf) - i * 2, "%02x", uuid[i]);
srs_assert(r0 > 0 && r0 < sizeof(buf) - i * 2);
} }
server_id_ = string(buf, sizeof(buf)); server_id_ = buf;
} }
return trd_->start(); return trd_->start();

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4 #define VERSION_MAJOR 4
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 253 #define VERSION_REVISION 254
#endif #endif