summaryrefslogtreecommitdiff
path: root/src/trunnel/link_handshake.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/trunnel/link_handshake.c')
-rw-r--r--src/trunnel/link_handshake.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/trunnel/link_handshake.c b/src/trunnel/link_handshake.c
index f9b55f0739..3ef7341ae9 100644
--- a/src/trunnel/link_handshake.c
+++ b/src/trunnel/link_handshake.c
@@ -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,7 +537,8 @@ 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;
- memcpy(ptr, obj->body.elts_, elt_len);
+ if (elt_len)
+ memcpy(ptr, obj->body.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@@ -589,7 +590,8 @@ 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;
- memcpy(obj->body.elts_, ptr, 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);
return len_in - remaining;
@@ -840,7 +842,8 @@ 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;
- memcpy(ptr, obj->sig.elts_, elt_len);
+ if (elt_len)
+ memcpy(ptr, obj->sig.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@@ -899,7 +902,8 @@ 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;
- memcpy(obj->sig.elts_, ptr, 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);
return len_in - remaining;
@@ -1467,7 +1471,8 @@ 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;
- memcpy(ptr, obj->sig.elts_, elt_len);
+ if (elt_len)
+ memcpy(ptr, obj->sig.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@@ -1576,7 +1581,8 @@ 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;
- memcpy(obj->sig.elts_, ptr, remaining);
+ if (remaining)
+ memcpy(obj->sig.elts_, ptr, remaining);
ptr += remaining; remaining -= remaining;
trunnel_assert(ptr + remaining == input + len_in);
return len_in - remaining;