bgp_write: fix sent data (offset) on partial write
&peer->outbuf->packet has a non-1 size, so &foo + offset would incorrectly offset by sizeof(packet) * offset, while it is meant as a byte offset. Cast to char * to have a simple offset. Reported-by: Coverity#375309
This commit is contained in:
parent
bbedc40bf2
commit
54be500888
1 changed files with 1 additions and 1 deletions
2
bgp.c
2
bgp.c
|
|
@ -1028,7 +1028,7 @@ static int bgp_write(struct bgp_peer *peer)
|
||||||
int len = htons(peer->outbuf->packet.header.len);
|
int len = htons(peer->outbuf->packet.header.len);
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
while ((r = write(peer->sock, &peer->outbuf->packet + peer->outbuf->done,
|
while ((r = write(peer->sock, (char*)&peer->outbuf->packet + peer->outbuf->done,
|
||||||
len - peer->outbuf->done)) == -1)
|
len - peer->outbuf->done)) == -1)
|
||||||
{
|
{
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue