mirror of
https://github.com/coturn/coturn.git
synced 2025-11-08 02:40:59 +01:00
Avoid read-past-end of string in get_bold_admin_title (#1499)
This commit is contained in:
parent
544382f313
commit
e8fa2f666a
@ -1533,11 +1533,12 @@ static ioa_socket_handle current_socket = NULL;
|
|||||||
|
|
||||||
static char *get_bold_admin_title(void) {
|
static char *get_bold_admin_title(void) {
|
||||||
static char sbat[1025];
|
static char sbat[1025];
|
||||||
strncpy(sbat, __bold_admin_title, sizeof(sbat));
|
strncpy(sbat, __bold_admin_title, sizeof(sbat) - 1);
|
||||||
|
sbat[sizeof(sbat) - 1] = '\0';
|
||||||
|
|
||||||
if (current_socket && current_socket->special_session) {
|
if (current_socket && current_socket->special_session) {
|
||||||
struct admin_session *as = (struct admin_session *)current_socket->special_session;
|
struct admin_session *as = (struct admin_session *)current_socket->special_session;
|
||||||
if (as->as_ok) {
|
if (as && as->as_ok) {
|
||||||
if (as->as_login[0]) {
|
if (as->as_login[0]) {
|
||||||
char *dst = sbat + strlen(sbat);
|
char *dst = sbat + strlen(sbat);
|
||||||
snprintf(dst, ADMIN_USER_MAX_LENGTH * 2 + 2, " admin user: <b><i>%s</i></b><br>\r\n", as->as_login);
|
snprintf(dst, ADMIN_USER_MAX_LENGTH * 2 + 2, " admin user: <b><i>%s</i></b><br>\r\n", as->as_login);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user