Update to trunnel 1.4.4 to fix 18373

This commit is contained in:
Nick Mathewson 2016-02-22 14:19:29 -05:00
parent 2240aa1269
commit a508119169
10 changed files with 38 additions and 21 deletions

5
changes/trunnel_update Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (code correctness):
- Update to the latest version of Trunnel, which tries harder
to avoid generating code that can invoke memcpy(p,NULL,0).
Bug found by clang address sanitizer. Fixes bug 18373. Bugfix
on 0.2.7.2-alpha.

View File

@ -1,4 +1,4 @@
/* trunnel-impl.h -- copied from Trunnel v1.4.3
/* trunnel-impl.h -- copied from Trunnel v1.4.4
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/

View File

@ -1,4 +1,4 @@
/* trunnel.c -- copied from Trunnel v1.4.3
/* trunnel.c -- copied from Trunnel v1.4.4
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/

View File

@ -1,4 +1,4 @@
/* trunnel.h -- copied from Trunnel v1.4.3
/* trunnel.h -- copied from Trunnel v1.4.4
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/

View File

@ -1,4 +1,4 @@
/* ed25519_cert.c -- generated by Trunnel v1.4.3.
/* ed25519_cert.c -- generated by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/
@ -289,6 +289,7 @@ ed25519_cert_extension_encode(uint8_t *output, const size_t avail, const ed25519
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->un_unparsed.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -374,6 +375,7 @@ ed25519_cert_extension_parse_into(ed25519_cert_extension_t *obj, const uint8_t *
/* Parse u8 un_unparsed[] */
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->un_unparsed, remaining, {});
obj->un_unparsed.n_ = remaining;
if (remaining)
memcpy(obj->un_unparsed.elts_, ptr, remaining);
ptr += remaining; remaining -= remaining;
break;

View File

@ -1,4 +1,4 @@
/* ed25519_cert.h -- generated by by Trunnel v1.4.3.
/* ed25519_cert.h -- generated by by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/

View File

@ -1,4 +1,4 @@
/* link_handshake.c -- generated by Trunnel v1.4.3.
/* link_handshake.c -- generated by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/
@ -537,6 +537,7 @@ certs_cell_cert_encode(uint8_t *output, const size_t avail, const certs_cell_cer
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->body.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -589,6 +590,7 @@ certs_cell_cert_parse_into(certs_cell_cert_t *obj, const uint8_t *input, const s
CHECK_REMAINING(obj->cert_len, truncated);
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->body, obj->cert_len, {});
obj->body.n_ = obj->cert_len;
if (obj->cert_len)
memcpy(obj->body.elts_, ptr, obj->cert_len);
ptr += obj->cert_len; remaining -= obj->cert_len;
trunnel_assert(ptr + remaining == input + len_in);
@ -840,6 +842,7 @@ rsa_ed_crosscert_encode(uint8_t *output, const size_t avail, const rsa_ed_crossc
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->sig.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -899,6 +902,7 @@ rsa_ed_crosscert_parse_into(rsa_ed_crosscert_t *obj, const uint8_t *input, const
CHECK_REMAINING(obj->sig_len, truncated);
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->sig, obj->sig_len, {});
obj->sig.n_ = obj->sig_len;
if (obj->sig_len)
memcpy(obj->sig.elts_, ptr, obj->sig_len);
ptr += obj->sig_len; remaining -= obj->sig_len;
trunnel_assert(ptr + remaining == input + len_in);
@ -1467,6 +1471,7 @@ auth1_encode(uint8_t *output, const size_t avail, const auth1_t *obj, const auth
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->sig.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -1576,6 +1581,7 @@ auth1_parse_into(auth1_t *obj, const uint8_t *input, const size_t len_in, const
/* Parse u8 sig[] */
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->sig, remaining, {});
obj->sig.n_ = remaining;
if (remaining)
memcpy(obj->sig.elts_, ptr, remaining);
ptr += remaining; remaining -= remaining;
trunnel_assert(ptr + remaining == input + len_in);

View File

@ -1,4 +1,4 @@
/* link_handshake.h -- generated by by Trunnel v1.4.3.
/* link_handshake.h -- generated by by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/

View File

@ -1,4 +1,4 @@
/* pwbox.c -- generated by Trunnel v1.4.3.
/* pwbox.c -- generated by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/
@ -362,6 +362,7 @@ pwbox_encoded_encode(uint8_t *output, size_t avail, const pwbox_encoded_t *obj)
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->skey_header.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -380,6 +381,7 @@ pwbox_encoded_encode(uint8_t *output, size_t avail, const pwbox_encoded_t *obj)
trunnel_assert(written <= avail);
if (avail - written < elt_len)
goto truncated;
if (elt_len)
memcpy(ptr, obj->data.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@ -460,6 +462,7 @@ pwbox_encoded_parse_into(pwbox_encoded_t *obj, const uint8_t *input, const size_
CHECK_REMAINING(obj->header_len, truncated);
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->skey_header, obj->header_len, {});
obj->skey_header.n_ = obj->header_len;
if (obj->header_len)
memcpy(obj->skey_header.elts_, ptr, obj->header_len);
ptr += obj->header_len; remaining -= obj->header_len;
@ -476,6 +479,7 @@ pwbox_encoded_parse_into(pwbox_encoded_t *obj, const uint8_t *input, const size_
/* Parse u8 data[] */
TRUNNEL_DYNARRAY_EXPAND(uint8_t, &obj->data, remaining, {});
obj->data.n_ = remaining;
if (remaining)
memcpy(obj->data.elts_, ptr, remaining);
ptr += remaining; remaining -= remaining;
if (remaining != 0)

View File

@ -1,4 +1,4 @@
/* pwbox.h -- generated by by Trunnel v1.4.3.
/* pwbox.h -- generated by by Trunnel v1.4.4.
* https://gitweb.torproject.org/trunnel.git
* You probably shouldn't edit this file.
*/