mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 21:37:08 +00:00
Merge pull request #9191 from idryzhov/rip-auth
ripd: fix authentication key length
This commit is contained in:
commit
cdc549b51a
12
ripd/ripd.c
12
ripd/ripd.c
@ -920,9 +920,11 @@ static int rip_auth_md5(struct rip_packet *packet, struct sockaddr_in *from,
|
||||
if (key == NULL || key->string == NULL)
|
||||
return 0;
|
||||
|
||||
strlcpy(auth_str, key->string, sizeof(auth_str));
|
||||
memcpy(auth_str, key->string,
|
||||
MIN(sizeof(auth_str), strlen(key->string)));
|
||||
} else if (ri->auth_str)
|
||||
strlcpy(auth_str, ri->auth_str, sizeof(auth_str));
|
||||
memcpy(auth_str, ri->auth_str,
|
||||
MIN(sizeof(auth_str), strlen(ri->auth_str)));
|
||||
|
||||
if (auth_str[0] == 0)
|
||||
return 0;
|
||||
@ -965,9 +967,11 @@ static void rip_auth_prepare_str_send(struct rip_interface *ri, struct key *key,
|
||||
|
||||
memset(auth_str, 0, len);
|
||||
if (key && key->string)
|
||||
strlcpy(auth_str, key->string, len);
|
||||
memcpy(auth_str, key->string,
|
||||
MIN((size_t)len, strlen(key->string)));
|
||||
else if (ri->auth_str)
|
||||
strlcpy(auth_str, ri->auth_str, len);
|
||||
memcpy(auth_str, ri->auth_str,
|
||||
MIN((size_t)len, strlen(ri->auth_str)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user