Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malicious code vulnerability may expose internal representation by incorporating reference to mutable object #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/net/spy/memcached/CachedData.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public CachedData(int f, byte[] d, int maxSize) {
+ " byte object)");
}
flags = f;
data = d;
data = d == null ? null : d.clone();
}

/**
* Get the stored data.
*/
public byte[] getData() {
return data;
return data == null ? null : data.clone();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/spy/memcached/auth/AuthDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class AuthDescriptor {
* @param h the callback handler for grabbing credentials and stuff
*/
public AuthDescriptor(String[] m, CallbackHandler h) {
mechs = m;
mechs = m == null ? null : m.clone();
cbh = h;
authAttempts = 0;
String authThreshhold =
Expand Down Expand Up @@ -91,7 +91,7 @@ public boolean authThresholdReached() {
}

public String[] getMechs() {
return mechs;
return mechs == null ? null : mechs.clone();
}

public CallbackHandler getCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public abstract class SASLBaseOperationImpl extends OperationImpl {
public SASLBaseOperationImpl(byte c, String[] m, byte[] ch, String s,
Map<String, ?> p, CallbackHandler h, OperationCallback cb) {
super(c, generateOpaque(), cb);
mech = m;
challenge = ch;
mech = m == null ? null : m.clone();
challenge = ch == null ? null : ch.clone();
serverName = s;
props = p;
cbh = h;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void setVbucketlist(short[] vbs) {
int oldSize = (vblist.length + 1) * 2;
int newSize = (vbs.length + 1) * 2;
totalbody += newSize - oldSize;
vblist = vbs;
vblist = vbs == null ? null : vbs.clone();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public String getKey() {
* @return The value data.
*/
public byte[] getValue() {
return value;
return value == null ? null : value.clone();
}

/**
Expand All @@ -266,7 +266,7 @@ public byte[] getValue() {
* @return The revid of the document.
*/
public byte[] getRevID() {
return revid;
return revid == null ? null : revid.clone();
}

public ByteBuffer getBytes() {
Expand Down