need help in understanding a piece of code in snort 2.9.7.3

Vicky Singh <[email protected]>
Newsgroups gmane.comp.security.ids.snort.devel
Message-ID <CAC-LuCznGV2ep1X4dh6NgMc2YgfrBMotr5cmWqu5gdfArEChJA@mail.gmail.com>
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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e

_______________________________________________
Snort-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/snort-devel
Archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-devel

Please visit http://blog.snort.org for the latest news about Snort!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.