Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix possible null pointer access.

  • Loading branch information...
commit 2b700065da8df20dfd93c09def6a59916e46d908 1 parent 64fc4e2
@wernerd authored
View
16 src/gnu/java/zrtp/jmf/transform/srtp/SRTCPTransformer.java
@@ -52,8 +52,12 @@ public RawPacket transform(RawPacket pkt) {
if (context == null) {
context = engine.getDefaultContextControl().deriveContext(ssrc);
- context.deriveSrtcpKeys();
- contexts.put(ssrc, context);
+ if (context != null) {
+ context.deriveSrtcpKeys();
+ contexts.put(ssrc, context);
+ }
+ else
+ return pkt;
}
context.transformPacket(pkt);
return pkt;
@@ -72,8 +76,12 @@ public RawPacket reverseTransform(RawPacket pkt) {
if (context == null) {
context = engine.getDefaultContextControl().deriveContext(ssrc);
- context.deriveSrtcpKeys();
- contexts.put(ssrc, context);
+ if (context != null) {
+ context.deriveSrtcpKeys();
+ contexts.put(ssrc, context);
+ }
+ else
+ return pkt;
}
boolean validPacket = context.reverseTransformPacket(pkt);
View
16 src/gnu/java/zrtp/jmf/transform/srtp/SRTPTransformer.java
@@ -77,8 +77,12 @@ public RawPacket transform(RawPacket pkt) {
if (context == null) {
context = engine.getDefaultContext().deriveContext(ssrc, 0, 0);
- context.deriveSrtpKeys(0);
- contexts.put(ssrc, context);
+ if (context != null) {
+ context.deriveSrtpKeys(0);
+ contexts.put(ssrc, context);
+ }
+ else
+ return pkt;
}
context.transformPacket(pkt);
@@ -98,8 +102,12 @@ public RawPacket reverseTransform(RawPacket pkt) {
if (context == null) {
context = engine.getDefaultContext().deriveContext(ssrc, 0, 0);
- context.deriveSrtpKeys(seqNum);
- contexts.put(ssrc, context);
+ if (context != null) {
+ context.deriveSrtpKeys(seqNum);
+ contexts.put(ssrc, context);
+ }
+ else
+ return pkt;
}
boolean validPacket = context.reverseTransformPacket(pkt);
Please sign in to comment.
Something went wrong with that request. Please try again.