File: fuzz_packet.c

package info (click to toggle)
knot 3.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,880 kB
  • sloc: ansic: 154,039; sh: 5,963; python: 1,141; makefile: 818
file content (22 lines) | stat: -rw-r--r-- 466 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*  Copyright (C) CZ.NIC, z.s.p.o. and contributors
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  For more information, see <https://www.knot-dns.cz/>
 */

#include <stdint.h>

#include "libknot/packet/pkt.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
	uint8_t copy[1 + size];
	memcpy(copy, data, size);

	knot_pkt_t *pkt = knot_pkt_new(copy, size, NULL);
	if (pkt != NULL) {
		knot_pkt_parse(pkt, 0);
		knot_pkt_free(pkt);
	}

	return 0;
}