static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['static int test_PACKET_copy_bytes()\n{\n    unsigned char bytes[4];\n    PACKET pkt;\n    if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))\n            || !TEST_true(PACKET_copy_bytes(&pkt, bytes, 4))\n            || !TEST_char_eq(bytes[0], 2)\n            || !TEST_char_eq(bytes[1], 4)\n            || !TEST_char_eq(bytes[2], 6)\n            || !TEST_char_eq(bytes[3], 8)\n            || !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN - 4)\n            || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8))\n            || !TEST_true(PACKET_copy_bytes(&pkt, bytes, 4))\n            || !TEST_uchar_eq(bytes[0], 0xf8)\n            || !TEST_uchar_eq(bytes[1], 0xfa)\n            || !TEST_uchar_eq(bytes[2], 0xfc)\n            || !TEST_uchar_eq(bytes[3], 0xfe)\n            || !TEST_false(PACKET_remaining(&pkt)))\n        return 0;\n    return 1;\n}', 'static ossl_inline int PACKET_buf_init(PACKET *pkt,\n                                              const unsigned char *buf,\n                                              size_t len)\n{\n    if (len > (size_t)(SIZE_MAX / 2))\n        return 0;\n    pkt->curr = buf;\n    pkt->remaining = len;\n    return 1;\n}', 'static ossl_inline int PACKET_copy_bytes(PACKET *pkt,\n                                                unsigned char *data, size_t len)\n{\n    if (!PACKET_peek_copy_bytes(pkt, data, len))\n        return 0;\n    packet_forward(pkt, len);\n    return 1;\n}', 'static ossl_inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']