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]
This commit is contained in:
Linus Torvalds
2017-11-08 11:21:52 -08:00
+2 -2
View File
@@ -228,7 +228,7 @@ next_op:
hdr = 2; hdr = 2;
/* Extract a tag from the data */ /* Extract a tag from the data */
if (unlikely(dp >= datalen - 1)) if (unlikely(datalen - dp < 2))
goto data_overrun_error; goto data_overrun_error;
tag = data[dp++]; tag = data[dp++];
if (unlikely((tag & 0x1f) == ASN1_LONG_TAG)) if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))
@@ -274,7 +274,7 @@ next_op:
int n = len - 0x80; int n = len - 0x80;
if (unlikely(n > 2)) if (unlikely(n > 2))
goto length_too_long; goto length_too_long;
if (unlikely(dp >= datalen - n)) if (unlikely(n > datalen - dp))
goto data_overrun_error; goto data_overrun_error;
hdr += n; hdr += n;
for (len = 0; n > 0; n--) { for (len = 0; n > 0; n--) {