Language: Python
Label: safe
CWE: CWE-787 \u2014 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.

Code:
def make_byte_array_copier(dst, src):
    assert isinstance(src.typ, _BytestringT)
    assert isinstance(dst.typ, _BytestringT)

    _check_assign_bytes(dst, src)

    # TODO: remove this branch, copy_bytes and get_bytearray_length should handle
    if src.value == "~empty":
        # set length word to 0.
        return STORE(dst, 0)

    with src.cache_when_complex("src") as (b1, src):
        with get_bytearray_length(src).cache_when_complex("len") as (b2, len_):
            max_bytes = src.typ.maxlen

            ret = ["seq"]

            dst_ = bytes_data_ptr(dst)
            src_ = bytes_data_ptr(src)

            ret.append(copy_bytes(dst_, src_, len_, max_bytes))

            # store length
            ret.append(STORE(dst, len_))

            return b1.resolve(b2.resolve(ret))