Skip to content

Commit

Permalink
mdns: check return value of sendto
Browse files Browse the repository at this point in the history
Coverity:
CID 739617 (#1 of 1): Unchecked return value (CHECKED_RETURN)
At (7): Calling function "sendto(walker->helloSkfd, (char const *)hello,
        25UL, 0, (struct sockaddr *)&dest, 16U)" without checking return
        value. This library function may fail and return an error code.
At (8): No check of the return value of "sendto(walker->helloSkfd, (
        char const *)hello, 25UL, 0, (struct sockaddr *)&dest, 16U)".

CID 739617 (#2 of 2): Unchecked return value (CHECKED_RETURN)
At (7): Calling function "sendto(walker->helloSkfd, (char const *)hello,
        25UL, 0, (struct sockaddr *)&dest6, 28U)" without checking
        return value. This library function may fail and return an error
        code.
At (8): No check of the return value of "sendto(walker->helloSkfd, (
        char const *)hello, 25UL, 0, (struct sockaddr *)&dest6, 28U)".

Signed-off-by: Ferry Huberts <[email protected]>
  • Loading branch information
fhuberts committed Oct 23, 2012
1 parent a2f77d6 commit 9f59748
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/mdns/src/RouterElection.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ void helloTimer (void *foo __attribute__ ((unused))){

OLSR_PRINTF(1,"hello running \n");

sendto(walker->helloSkfd, (const char * ) hello,
sizeof(struct RtElHelloPkt), 0, (struct sockaddr *)&dest, sizeof(dest));
if (sendto(walker->helloSkfd, (const char * ) hello,
sizeof(struct RtElHelloPkt), 0, (struct sockaddr *)&dest, sizeof(dest)) < 0) {
BmfPError("Could not send to interface %s", walker->olsrIntf->int_name);
}
}
else{
memset((char *) &dest6, 0, sizeof(dest6));
Expand All @@ -132,8 +134,10 @@ void helloTimer (void *foo __attribute__ ((unused))){

OLSR_PRINTF(1,"hello running \n");

sendto(walker->helloSkfd, (const char * ) hello,
sizeof(struct RtElHelloPkt), 0, (struct sockaddr *)&dest6, sizeof(dest6));
if (sendto(walker->helloSkfd, (const char * ) hello,
sizeof(struct RtElHelloPkt), 0, (struct sockaddr *)&dest6, sizeof(dest6)) < 0) {
BmfPError("Could not send to interface %s", walker->olsrIntf->int_name);
}
}
}
return;
Expand Down

0 comments on commit 9f59748

Please sign in to comment.