Fix error handling of stub parsers. In case of SCRealloc error the
function would return a non-error code. This could possibly lead to
memory corruption.
Reported-By: The Yahoo pentest team
DCERPC_FIELD_MAX,
};
+/** \internal
+ * \retval stub_len or 0 in case of error */
static uint32_t FragmentDataParser(Flow *f, void *dcerpcudp_state,
AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len)
SCFree(*stub_data_buffer);
*stub_data_buffer = NULL;
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
- goto end;
+ SCReturnUInt(0);
}
*stub_data_buffer = ptmp;
}
#endif
-end:
SCReturnUInt((uint32_t)stub_len);
}
SCReturnUInt((uint32_t)(p - input));
}
+/** \internal
+ * \retval stub_len or 0 in case of error */
static uint32_t StubDataParser(DCERPC *dcerpc, uint8_t *input, uint32_t input_len)
{
SCEnter();
SCFree(*stub_data_buffer);
*stub_data_buffer = NULL;
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
- goto end;
+ SCReturnUInt(0);
}
*stub_data_buffer = ptmp;
}
#endif
-end:
SCReturnUInt((uint32_t)stub_len);
}