exim.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. Security patches regarding two issues discussed at
  2. http://www.exim.org/mail-archives/exim-announce/2005/msg00000.html
  3. diff -Naur exim-4.43.orig/src/auths/auth-spa.c exim-4.43/src/auths/auth-spa.c
  4. --- exim-4.43.orig/src/auths/auth-spa.c 2004-10-05 10:32:08.000000000 +0200
  5. +++ exim-4.43/src/auths/auth-spa.c 2005-01-07 08:32:42.000000000 +0100
  6. @@ -405,7 +405,7 @@
  7. }
  8. int
  9. -spa_base64_to_bits (char *out, const char *in)
  10. +spa_base64_to_bits (char *out, int outlength, const char *in)
  11. /* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
  12. {
  13. int len = 0;
  14. @@ -418,6 +418,8 @@
  15. do
  16. {
  17. + if (len >= outlength)
  18. + return (-1);
  19. digit1 = in[0];
  20. if (DECODE64 (digit1) == BAD)
  21. return (-1);
  22. @@ -435,11 +437,15 @@
  23. ++len;
  24. if (digit3 != '=')
  25. {
  26. + if (len >= outlength)
  27. + return (-1);
  28. *out++ =
  29. ((DECODE64 (digit2) << 4) & 0xf0) | (DECODE64 (digit3) >> 2);
  30. ++len;
  31. if (digit4 != '=')
  32. {
  33. + if (len >= outlength)
  34. + return (-1);
  35. *out++ = ((DECODE64 (digit3) << 6) & 0xc0) | DECODE64 (digit4);
  36. ++len;
  37. }
  38. diff -Naur exim-4.43.orig/src/auths/auth-spa.h exim-4.43/src/auths/auth-spa.h
  39. --- exim-4.43.orig/src/auths/auth-spa.h 2004-10-05 10:32:08.000000000 +0200
  40. +++ exim-4.43/src/auths/auth-spa.h 2005-01-07 08:34:06.000000000 +0100
  41. @@ -10,6 +10,9 @@
  42. * Samba project (by Andrew Tridgell, Jeremy Allison, and others).
  43. */
  44. +/* December 2004: The spa_base64_to_bits() function has no length checking in
  45. +it. I have added a check. PH */
  46. +
  47. /* It seems that some systems have existing but different definitions of some
  48. of the following types. I received a complaint about "int16" causing
  49. compilation problems. So I (PH) have renamed them all, to be on the safe side.
  50. @@ -75,7 +78,7 @@
  51. #define spa_request_length(ptr) (((ptr)->buffer - (uint8x*)(ptr)) + (ptr)->bufIndex)
  52. void spa_bits_to_base64 (unsigned char *, const unsigned char *, int);
  53. -int spa_base64_to_bits(char *, const char *);
  54. +int spa_base64_to_bits(char *, int, const char *);
  55. void spa_build_auth_response (SPAAuthChallenge *challenge,
  56. SPAAuthResponse *response, char *user, char *password);
  57. void spa_build_auth_request (SPAAuthRequest *request, char *user,
  58. diff -Naur exim-4.43.orig/src/auths/spa.c exim-4.43/src/auths/spa.c
  59. --- exim-4.43.orig/src/auths/spa.c 2004-10-05 10:32:08.000000000 +0200
  60. +++ exim-4.43/src/auths/spa.c 2005-01-07 08:35:39.000000000 +0100
  61. @@ -133,7 +133,7 @@
  62. return FAIL;
  63. }
  64. -if (spa_base64_to_bits((char *)(&request), (const char *)(data)) < 0)
  65. +if (spa_base64_to_bits((char *)(&request), sizeof(request), (const char *)(data)) < 0)
  66. {
  67. DEBUG(D_auth) debug_printf("auth_spa_server(): bad base64 data in "
  68. "request: %s\n", data);
  69. @@ -153,7 +153,7 @@
  70. }
  71. /* dump client response */
  72. -if (spa_base64_to_bits((char *)(&response), (const char *)(data)) < 0)
  73. +if (spa_base64_to_bits((char *)(&response), sizeof(response), (const char *)(data)) < 0)
  74. {
  75. DEBUG(D_auth) debug_printf("auth_spa_server(): bad base64 data in "
  76. "response: %s\n", data);
  77. @@ -319,7 +319,7 @@
  78. /* convert the challenge into the challenge struct */
  79. DSPA("\n\n%s authenticator: challenge (%s)\n\n",
  80. ablock->name, buffer + 4);
  81. - spa_base64_to_bits ((char *)(&challenge), (const char *)(buffer + 4));
  82. + spa_base64_to_bits ((char *)(&challenge), sizeof(challenge), (const char *)(buffer + 4));
  83. spa_build_auth_response (&challenge, &response,
  84. CS username, CS password);
  85. diff -Naur exim-4.43.orig/src/host.c exim-4.43/src/host.c
  86. --- exim-4.43.orig/src/host.c 2004-10-05 10:32:08.000000000 +0200
  87. +++ exim-4.43/src/host.c 2005-01-07 08:28:02.000000000 +0100
  88. @@ -710,12 +710,18 @@
  89. if (*p == ':') p++;
  90. - /* Split the address into components separated by colons. */
  91. + /* Split the address into components separated by colons. The input address
  92. + is supposed to be checked for syntax. There was a case where this was
  93. + overlooked; to guard against that happening again, check here and crash if
  94. + there is a violation. */
  95. while (*p != 0)
  96. {
  97. int len = Ustrcspn(p, ":");
  98. if (len == 0) nulloffset = ci;
  99. + if (ci > 7) log_write(0, LOG_MAIN|LOG_PANIC_DIE,
  100. + "Internal error: invalid IPv6 address \"%s\" passed to host_aton()",
  101. + address);
  102. component[ci++] = p;
  103. p += len;
  104. if (*p == ':') p++;
  105. diff -Naur exim-4.43.orig/src/lookups/dnsdb.c exim-4.43/src/lookups/dnsdb.c
  106. --- exim-4.43.orig/src/lookups/dnsdb.c 2004-10-05 10:32:08.000000000 +0200
  107. +++ exim-4.43/src/lookups/dnsdb.c 2005-01-07 08:28:38.000000000 +0100
  108. @@ -125,7 +125,7 @@
  109. /* If the type is PTR, we have to construct the relevant magic lookup
  110. key. This code is now in a separate function. */
  111. -if (type == T_PTR)
  112. +if (type == T_PTR && string_is_ip_address(keystring, NULL))
  113. {
  114. dns_build_reverse(keystring, buffer);
  115. keystring = buffer;