Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
--- /dev/null
+/*
+ * Utilities for fuzzing frr.
+ */
+#ifndef __FUZZ_H__
+#define __FUZZ_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+static inline int frrfuzz_read_input(uint8_t **input)
+{
+ fseek(stdin, 0, SEEK_END);
+ long fsize = ftell(stdin);
+ if (fsize < 0)
+ return 0;
+
+ *input = (uint8_t *)malloc(fsize);
+
+ fseek(stdin, 0, SEEK_SET);
+ int r = fread(*input, 1, fsize, stdin);
+
+ return r;
+}
+
+#endif /* __FUZZ_H__ */
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define FUZZING 1
#ifndef _ZEBRA_H
#define _ZEBRA_H
+#define FUZZING 1
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <endian.h>
#endif
+
+#ifdef FUZZING
+#include "fuzz.h"
+#endif
+
+
/* machine dependent includes */
#ifdef HAVE_LINUX_VERSION_H
#include <linux/version.h>