summaryrefslogtreecommitdiff
path: root/src/trunnel/pwbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/trunnel/pwbox.c')
-rw-r--r--src/trunnel/pwbox.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/trunnel/pwbox.c b/src/trunnel/pwbox.c
index a80fbb949b..9b348a9b30 100644
--- a/src/trunnel/pwbox.c
+++ b/src/trunnel/pwbox.c
@@ -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,7 +362,8 @@ 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;
- memcpy(ptr, obj->skey_header.elts_, elt_len);
+ if (elt_len)
+ memcpy(ptr, obj->skey_header.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
@@ -380,7 +381,8 @@ 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;
- memcpy(ptr, obj->data.elts_, elt_len);
+ if (elt_len)
+ memcpy(ptr, obj->data.elts_, elt_len);
written += elt_len; ptr += elt_len;
}
trunnel_assert(written <= avail);
@@ -460,7 +462,8 @@ 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;
- memcpy(obj->skey_header.elts_, ptr, obj->header_len);
+ if (obj->header_len)
+ memcpy(obj->skey_header.elts_, ptr, obj->header_len);
ptr += obj->header_len; remaining -= obj->header_len;
/* Parse u8 iv[16] */
@@ -476,7 +479,8 @@ 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;
- memcpy(obj->data.elts_, ptr, remaining);
+ if (remaining)
+ memcpy(obj->data.elts_, ptr, remaining);
ptr += remaining; remaining -= remaining;
if (remaining != 0)
goto fail;