import struct


def read_packet_body(packet, length, header_size):
    """
    Gets packet body. On error, returns None.

    :param packet: Full packet
    :param length: Length of body in bytes
    :return: Packet body as string
    """
    fmt = '!%ds' % length
    body = packet[header_size:header_size + length]
    try:
        return struct.unpack(fmt, body)[0]
    except (struct.error, TypeError) as e:
        return None