mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
coverity 169267 - lwsgt strncpy may fill buffer without NUL
This commit is contained in:
parent
e35d91a860
commit
16f3e4cacf
1 changed files with 6 additions and 4 deletions
|
@ -418,7 +418,8 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
|
||||||
|
|
||||||
pss->login_session.id[0] = '\0';
|
pss->login_session.id[0] = '\0';
|
||||||
pss->phs.pos = 0;
|
pss->phs.pos = 0;
|
||||||
strncpy(pss->onward, (char *)in, sizeof(pss->onward));
|
strncpy(pss->onward, (char *)in, sizeof(pss->onward) - 1);
|
||||||
|
pss->onward[sizeof(pss->onward) - 1] = '\0';
|
||||||
|
|
||||||
if (!strcmp((const char *)in, "/lwsgs-forgot")) {
|
if (!strcmp((const char *)in, "/lwsgs-forgot")) {
|
||||||
lwsgs_handler_forgot(vhd, wsi, pss);
|
lwsgs_handler_forgot(vhd, wsi, pss);
|
||||||
|
@ -512,9 +513,10 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
|
||||||
sqlite3_errmsg(vhd->pdb));
|
sqlite3_errmsg(vhd->pdb));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strncpy(sinfo->username, u.username, sizeof(sinfo->username));
|
strncpy(sinfo->username, u.username, sizeof(sinfo->username) - 1);
|
||||||
strncpy(sinfo->email, u.email, sizeof(sinfo->email));
|
sinfo->username[sizeof(sinfo->username) - 1] = '\0';
|
||||||
strncpy(sinfo->session, sid.id, sizeof(sinfo->session));
|
strncpy(sinfo->email, u.email, sizeof(sinfo->email) - 1);
|
||||||
|
strncpy(sinfo->session, sid.id, sizeof(sinfo->session) - 1);
|
||||||
sinfo->mask = lwsgs_get_auth_level(vhd, username);
|
sinfo->mask = lwsgs_get_auth_level(vhd, username);
|
||||||
lws_get_peer_simple(wsi, sinfo->ip, sizeof(sinfo->ip));
|
lws_get_peer_simple(wsi, sinfo->ip, sizeof(sinfo->ip));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue