Skip to content

Commit

Permalink
Setting the src address before encrypting a message (https://issues.r…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Mar 17, 2023
1 parent 44708df commit c41313b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/org/jgroups/protocols/Encrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ protected Message _decrypt(final Cipher cipher, Key key, Message msg, EncryptHea
}

protected Message encrypt(Message msg) throws Exception {
// To avoid NPE (https://issues.redhat.com/browse/JGRP-2680)
if(msg.getSrc() == null)
msg.setSrc(local_addr);
// copy needed because same message (object) may be retransmitted -> prevent double encryption
if(!msg.hasPayload())
return msg.putHeader(this.id, new EncryptHeader((byte)0, symVersion(), makeIv()));
Expand Down

0 comments on commit c41313b

Please sign in to comment.