diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-08 14:21:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-08 14:21:52 -0500 |
commit | d6a2cf07f0c91e339d2c53f1e1ca6e731af2e72a (patch) | |
tree | 191177732b23ff3e4dedac329372349bb6ba46f5 | |
parent | f7dc4c9a855a13dbb33294c9fc94f17af03f6291 (diff) | |
parent | 624f5ab8720b3371367327a822c267699c1823b8 (diff) |
Merge branch 'fixes-v4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull key handling fix from James Morris:
"Fix by Eric Biggers for the keys subsystem"
* 'fixes-v4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
KEYS: fix NULL pointer dereference during ASN.1 parsing [ver #2]
-rw-r--r-- | lib/asn1_decoder.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index fef5d2e114be..1ef0cec38d78 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c | |||
@@ -228,7 +228,7 @@ next_op: | |||
228 | hdr = 2; | 228 | hdr = 2; |
229 | 229 | ||
230 | /* Extract a tag from the data */ | 230 | /* Extract a tag from the data */ |
231 | if (unlikely(dp >= datalen - 1)) | 231 | if (unlikely(datalen - dp < 2)) |
232 | goto data_overrun_error; | 232 | goto data_overrun_error; |
233 | tag = data[dp++]; | 233 | tag = data[dp++]; |
234 | if (unlikely((tag & 0x1f) == ASN1_LONG_TAG)) | 234 | if (unlikely((tag & 0x1f) == ASN1_LONG_TAG)) |
@@ -274,7 +274,7 @@ next_op: | |||
274 | int n = len - 0x80; | 274 | int n = len - 0x80; |
275 | if (unlikely(n > 2)) | 275 | if (unlikely(n > 2)) |
276 | goto length_too_long; | 276 | goto length_too_long; |
277 | if (unlikely(dp >= datalen - n)) | 277 | if (unlikely(n > datalen - dp)) |
278 | goto data_overrun_error; | 278 | goto data_overrun_error; |
279 | hdr += n; | 279 | hdr += n; |
280 | for (len = 0; n > 0; n--) { | 280 | for (len = 0; n > 0; n--) { |