Skip to content

Commit

Permalink
Merge pull request ossec#2064 from staskysel/fix-overwriting-agent-co…
Browse files Browse the repository at this point in the history
…unter

Fix overwriting an agent counter with sender counter during updating keys
  • Loading branch information
atomicturtle authored Aug 7, 2023
2 parents 9463280 + ba1936d commit d42ae4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/remoted/sendmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ int send_msg(unsigned int agentid, const char *msg)
return (-1);
}

msg_size = CreateSecMSG(&keys, msg, crypt_msg, agentid);
if (msg_size == 0) {
merror(SEC_ERROR, ARGV0);
return (-1);
}

/* Lock before using */
if (pthread_mutex_lock(&sendmsg_mutex) != 0) {
merror(MUTEX_ERROR, ARGV0);
return (-1);
}

msg_size = CreateSecMSG(&keys, msg, crypt_msg, agentid);
if (msg_size == 0) {
merror(SEC_ERROR, ARGV0);
return (-1);
}

/* Send initial message */
dest_sa = (struct sockaddr *)&keys.keyentries[agentid]->peer_info;
sa_size = (dest_sa->sa_family == AF_INET) ?
Expand Down

0 comments on commit d42ae4a

Please sign in to comment.