[Snort-devel] need help in understanding a piece of code in snort 2.9.7.3

Vicky Singh vickyatwork0 at ...2499...
Fri May 27 05:43:58 EDT 2016


Hi

I need some help in understanding a piece of qsort usage on pointer in the
function PortTableCompileMergePortObjectList2() of the file
snort-2.9.7.3/src/sfutil/sfportobject.c. Below is the comment mentioned in
the code.

/* Sort the pointers to the input port objects so
   we always get them in the same order for key comparisons */

This piece of code sorts a list of pointers to port objects before merging
them. PortObjects are calloc'ed on the fly and on multiple run order of
memory allocated to different portObject may vary. I'm not able to
understand what value add this pointer sort adds here.

I tried removing this qsort and found attack detection to be working
properly. Can someone please help me understand the importance/usage of
pointer sort in this context?

Thanks
Vicky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.snort.org/pipermail/snort-devel/attachments/20160527/4d1ef425/attachment.html>


More information about the Snort-devel mailing list