mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 02:46:37 +00:00
isisd: strncpy -> strlcpy
strncpy is a byte copy function not a string copy function Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
cacbdfb14d
commit
e28544ed99
@ -1305,8 +1305,8 @@ ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit)
|
||||
return ferr_ok();
|
||||
}
|
||||
|
||||
static int isis_circuit_passwd_set(struct isis_circuit *circuit,
|
||||
uint8_t passwd_type, const char *passwd)
|
||||
ferr_r isis_circuit_passwd_set(struct isis_circuit *circuit,
|
||||
uint8_t passwd_type, const char *passwd)
|
||||
{
|
||||
int len;
|
||||
|
||||
@ -1319,7 +1319,8 @@ static int isis_circuit_passwd_set(struct isis_circuit *circuit,
|
||||
"circuit password too long (max 254 chars)");
|
||||
|
||||
circuit->passwd.len = len;
|
||||
strncpy((char *)circuit->passwd.passwd, passwd, 255);
|
||||
strlcpy((char *)circuit->passwd.passwd, passwd,
|
||||
sizeof(circuit->passwd.passwd));
|
||||
circuit->passwd.type = passwd_type;
|
||||
return ferr_ok();
|
||||
}
|
||||
|
@ -190,6 +190,8 @@ ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
|
||||
int metric);
|
||||
|
||||
ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit);
|
||||
ferr_r isis_circuit_passwd_set(struct isis_circuit *circuit,
|
||||
uint8_t passwd_type, const char *passwd);
|
||||
ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
|
||||
const char *passwd);
|
||||
ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
|
||||
|
@ -2092,8 +2092,8 @@ lib_interface_isis_password_password_modify(enum nb_event event,
|
||||
|
||||
password = yang_dnode_get_string(dnode, NULL);
|
||||
circuit = yang_dnode_get_entry(dnode, true);
|
||||
circuit->passwd.len = strlen(password);
|
||||
strncpy((char *)circuit->passwd.passwd, password, 255);
|
||||
|
||||
isis_circuit_passwd_set(circuit, circuit->passwd.type, password);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
@ -1363,7 +1363,7 @@ struct isis_lsp *lsp_for_arg(const char *argv, dict_t *lspdb)
|
||||
* xxxx.xxxx.xxxx
|
||||
*/
|
||||
if (argv)
|
||||
strncpy(sysid, argv, 254);
|
||||
strlcpy(sysid, argv, sizeof(sysid));
|
||||
if (argv && strlen(argv) > 3) {
|
||||
pos = argv + strlen(argv) - 3;
|
||||
if (strncmp(pos, "-", 1) == 0) {
|
||||
@ -1639,7 +1639,8 @@ static int isis_area_passwd_set(struct isis_area *area, int level,
|
||||
return -1;
|
||||
|
||||
modified.len = len;
|
||||
strncpy((char *)modified.passwd, passwd, 255);
|
||||
strlcpy((char *)modified.passwd, passwd,
|
||||
sizeof(modified.passwd));
|
||||
modified.type = passwd_type;
|
||||
modified.snp_auth = snp_auth;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user