1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## 99_SECURITY_CVE-2009-4484.dpatch by Giuseppe Iuculano <iuculano@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: CVE-2009-4484
@DPATCH@
diff -urNad mysql-dfsg-5.0~/extra/yassl/src/yassl_error.cpp mysql-dfsg-5.0/extra/yassl/src/yassl_error.cpp
--- mysql-dfsg-5.0~/extra/yassl/src/yassl_error.cpp 2006-12-20 12:14:04.000000000 +0100
+++ mysql-dfsg-5.0/extra/yassl/src/yassl_error.cpp 2010-02-12 14:57:30.000000000 +0100
@@ -255,6 +255,10 @@
strncpy(buffer, "ASN: bad other signature confirmation", max);
break;
+ case CONTENT_E :
+ strncpy(buffer, "bad content processing", max);
+ break;
+
case CERTFICATE_ERROR :
strncpy(buffer, "Unable to verify certificate", max);
break;
diff -urNad mysql-dfsg-5.0~/extra/yassl/taocrypt/include/asn.hpp mysql-dfsg-5.0/extra/yassl/taocrypt/include/asn.hpp
--- mysql-dfsg-5.0~/extra/yassl/taocrypt/include/asn.hpp 2006-12-20 12:14:04.000000000 +0100
+++ mysql-dfsg-5.0/extra/yassl/taocrypt/include/asn.hpp 2010-02-12 14:54:20.000000000 +0100
@@ -290,6 +290,7 @@
bool ValidateSignature(SignerList*);
bool ConfirmSignature(Source&);
void GetKey();
+ char* AddTag(char*, const char*, const char*, word32, word32);
void GetName(NameType);
void GetValidity();
void GetDate(DateType);
diff -urNad mysql-dfsg-5.0~/extra/yassl/taocrypt/include/error.hpp mysql-dfsg-5.0/extra/yassl/taocrypt/include/error.hpp
--- mysql-dfsg-5.0~/extra/yassl/taocrypt/include/error.hpp 2006-12-20 12:14:36.000000000 +0100
+++ mysql-dfsg-5.0/extra/yassl/taocrypt/include/error.hpp 2010-02-12 14:56:55.000000000 +0100
@@ -70,7 +70,9 @@
BEFORE_DATE_E = 1036, // "before date in the future"
AFTER_DATE_E = 1037, // "after date in the past"
SIG_CONFIRM_E = 1038, // "bad self signature confirmation"
-SIG_OTHER_E = 1039 // "bad other signature confirmation"
+SIG_OTHER_E = 1039, // "bad other signature confirmation"
+
+CONTENT_E = 1040 // "bad content processing"
};
diff -urNad mysql-dfsg-5.0~/extra/yassl/taocrypt/src/asn.cpp mysql-dfsg-5.0/extra/yassl/taocrypt/src/asn.cpp
--- mysql-dfsg-5.0~/extra/yassl/taocrypt/src/asn.cpp 2006-12-20 12:14:38.000000000 +0100
+++ mysql-dfsg-5.0/extra/yassl/taocrypt/src/asn.cpp 2010-02-12 14:54:20.000000000 +0100
@@ -659,6 +659,23 @@
}
+char *CertDecoder::AddTag(char *ptr, const char *buf_end,
+ const char *tag_name, word32 tag_name_length,
+ word32 tag_value_length)
+{
+ if (ptr + tag_name_length + tag_value_length > buf_end)
+ return 0;
+
+ memcpy(ptr, tag_name, tag_name_length);
+ ptr+= tag_name_length;
+
+ memcpy(ptr, source_.get_current(), tag_value_length);
+ ptr+= tag_value_length;
+
+ return ptr;
+}
+
+
// process NAME, either issuer or subject
void CertDecoder::GetName(NameType nt)
{
@@ -666,11 +683,21 @@
SHA sha;
word32 length = GetSequence(); // length of all distinguished names
- assert (length < ASN_NAME_MAX);
+
+ if (length >= ASN_NAME_MAX)
+ goto err;
length += source_.get_index();
- char* ptr = (nt == ISSUER) ? issuer_ : subject_;
- word32 idx = 0;
+ char *ptr, *buf_end;
+
+ if (nt == ISSUER) {
+ ptr= issuer_;
+ buf_end= ptr + sizeof(issuer_) - 1; // 1 byte for trailing 0
+ }
+ else {
+ ptr= subject_;
+ buf_end= ptr + sizeof(subject_) - 1; // 1 byte for trailing 0
+ }
while (source_.get_index() < length) {
GetSet();
@@ -692,47 +719,36 @@
byte id = source_.next();
b = source_.next(); // strType
word32 strLen = GetLength(source_);
- bool copy = false;
-
- if (id == COMMON_NAME) {
- memcpy(&ptr[idx], "/CN=", 4);
- idx += 4;
- copy = true;
- }
- else if (id == SUR_NAME) {
- memcpy(&ptr[idx], "/SN=", 4);
- idx += 4;
- copy = true;
- }
- else if (id == COUNTRY_NAME) {
- memcpy(&ptr[idx], "/C=", 3);
- idx += 3;
- copy = true;
- }
- else if (id == LOCALITY_NAME) {
- memcpy(&ptr[idx], "/L=", 3);
- idx += 3;
- copy = true;
- }
- else if (id == STATE_NAME) {
- memcpy(&ptr[idx], "/ST=", 4);
- idx += 4;
- copy = true;
- }
- else if (id == ORG_NAME) {
- memcpy(&ptr[idx], "/O=", 3);
- idx += 3;
- copy = true;
- }
- else if (id == ORGUNIT_NAME) {
- memcpy(&ptr[idx], "/OU=", 4);
- idx += 4;
- copy = true;
- }
- if (copy) {
- memcpy(&ptr[idx], source_.get_current(), strLen);
- idx += strLen;
+ switch (id) {
+ case COMMON_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/CN=", 4, strLen)))
+ goto err;
+ break;
+ case SUR_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/SN=", 4, strLen)))
+ goto err;
+ break;
+ case COUNTRY_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/C=", 3, strLen)))
+ goto err;
+ break;
+ case LOCALITY_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/L=", 3, strLen)))
+ goto err;
+ break;
+ case STATE_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/ST=", 4, strLen)))
+ goto err;
+ break;
+ case ORG_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/O=", 3, strLen)))
+ goto err;
+ break;
+ case ORGUNIT_NAME:
+ if (!(ptr= AddTag(ptr, buf_end, "/OU=", 4, strLen)))
+ goto err;
+ break;
}
sha.Update(source_.get_current(), strLen);
@@ -745,12 +761,14 @@
source_.advance(length);
}
}
- ptr[idx++] = 0;
+ *ptr= 0;
- if (nt == ISSUER)
- sha.Final(issuerHash_);
- else
- sha.Final(subjectHash_);
+ sha.Final(nt == ISSUER ? issuerHash_ : subjectHash_);
+
+ return;
+
+err:
+ source_.SetError(CONTENT_E);
}
|