fmemopen() does not like 0-length input.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
TALLOC_CTX *mem_ctx;
struct conv_options opt;
+ if (len == 0) {
+ /*
+ * Otherwise fmemopen() will return null and set errno
+ * to EINVAL
+ */
+ return 0;
+ }
+
mem_ctx = talloc_init(__FUNCTION__);
opt.in = fmemopen(buf, len, "r");
int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len)
{
- FILE *fp;
+ FILE *fp = NULL;
+
+ if (len == 0) {
+ /*
+ * Otherwise fmemopen() will return null and set errno
+ * to EINVAL
+ */
+ return 0;
+ }
fp = fmemopen(buf, len, "r");