Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97696
b: refs/heads/master
c: ddb2c43
h: refs/heads/master
v: v3
  • Loading branch information
Chris Wright authored and Linus Torvalds committed Jun 5, 2008
1 parent dddd85e commit 4351276
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: efedf51c866130945b5db755cb58670e60205d83
refs/heads/master: ddb2c43594f22843e9f3153da151deaba1a834c5
14 changes: 14 additions & 0 deletions trunk/fs/cifs/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ asn1_length_decode(struct asn1_ctx *ctx, unsigned int *def, unsigned int *len)
}
}
}

/* don't trust len bigger than ctx buffer */
if (*len > ctx->end - ctx->pointer)
return 0;

return 1;
}

Expand All @@ -203,6 +208,10 @@ asn1_header_decode(struct asn1_ctx *ctx,
if (!asn1_length_decode(ctx, &def, &len))
return 0;

/* primitive shall be definite, indefinite shall be constructed */
if (*con == ASN1_PRI && !def)
return 0;

if (def)
*eoc = ctx->pointer + len;
else
Expand Down Expand Up @@ -389,6 +398,11 @@ asn1_oid_decode(struct asn1_ctx *ctx,
unsigned long *optr;

size = eoc - ctx->pointer + 1;

/* first subid actually encodes first two subids */
if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
return 0;

*oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
if (*oid == NULL)
return 0;
Expand Down
14 changes: 14 additions & 0 deletions trunk/net/ipv4/netfilter/nf_nat_snmp_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ static unsigned char asn1_length_decode(struct asn1_ctx *ctx,
}
}
}

/* don't trust len bigger than ctx buffer */
if (*len > ctx->end - ctx->pointer)
return 0;

return 1;
}

Expand All @@ -250,6 +255,10 @@ static unsigned char asn1_header_decode(struct asn1_ctx *ctx,
if (!asn1_length_decode(ctx, &def, &len))
return 0;

/* primitive shall be definite, indefinite shall be constructed */
if (*con == ASN1_PRI && !def)
return 0;

if (def)
*eoc = ctx->pointer + len;
else
Expand Down Expand Up @@ -434,6 +443,11 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
unsigned long *optr;

size = eoc - ctx->pointer + 1;

/* first subid actually encodes first two subids */
if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
return 0;

*oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
if (*oid == NULL) {
if (net_ratelimit())
Expand Down

0 comments on commit 4351276

Please sign in to comment.