0001-fix-CVE-2019-17362.patch 1.1 KB

1234567891011121314151617181920212223242526272829
  1. From 25c26a3b7a9ad8192ccc923e15cf62bf0108ef94 Mon Sep 17 00:00:00 2001
  2. From: werew <werew@ret2libc.com>
  3. Date: Thu, 3 Oct 2019 19:57:10 +0200
  4. Subject: [PATCH] Fixes #507
  5. Fix a vulnerability in der_decode_utf8_string as specified here:
  6. https://github.com/libtom/libtomcrypt/issues/507
  7. [for import into Buildroot]
  8. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
  9. ---
  10. src/pk/asn1/der/utf8/der_decode_utf8_string.c | 2 +-
  11. 1 file changed, 1 insertion(+), 1 deletion(-)
  12. diff --git a/src/pk/asn1/der/utf8/der_decode_utf8_string.c b/src/pk/asn1/der/utf8/der_decode_utf8_string.c
  13. index 94555b99f..d3ed82bea 100644
  14. --- a/src/pk/asn1/der/utf8/der_decode_utf8_string.c
  15. +++ b/src/pk/asn1/der/utf8/der_decode_utf8_string.c
  16. @@ -65,7 +65,7 @@ int der_decode_utf8_string(const unsigned char *in, unsigned long inlen,
  17. /* count number of bytes */
  18. for (z = 0; (tmp & 0x80) && (z <= 4); z++, tmp = (tmp << 1) & 0xFF);
  19. - if (z > 4 || (x + (z - 1) > inlen)) {
  20. + if (z == 1 || z > 4 || (x + (z - 1) > inlen)) {
  21. return CRYPT_INVALID_PACKET;
  22. }