Closed mfrey closed 5 years ago
In fact, this is an interessting question. I think if prefix was created by the prefix_new function this error cannot occur in practice. However, I think a check to avoid that comp is not zero, would be a good think. Nevertheless, the function can also crash if len(comp) !+ compcnt, which cannot be checked, right?
However, I think a check to avoid that comp is not zero, would be a good think.
To be honest, I have mixed feelings about that. Input validation is the job of a parser, so malicious packets or data needs to be handled (to some degree) by the parser. I fear that we end up adding checks everywhere ...
so do I. We already added checks when parsing the packets, to (hopefully) avoid this scenario from happening. So, I think, we agree here, that additional checks here are not necessary. I will close the issue, in case there are new insights, we can reopen it.
Description
If you set the number of components
compcnt
in accnl_prefix_s
based prefix to a number larger than0
and set the components toNULL
(or let the number of components/component count mismatch), the functionccnl_prefix_cmp
will crash.The crash will most likely happen in line 375.
Shall we consider this a bug or do we simply assume that other parts of ccn-lite will perform sanity-checks before the function will be called or wouldn't you consider it not an issue at all (having an "empty" prefix, but a positive number of components sounds a bit esoteric)?