Snort mailing list archives

Redundant call to fseek() in u2spewfoo.cc in Snort-3.0.0a3/a4


From: Bill Parker <wp02855 () gmail com>
Date: Thu, 4 Feb 2016 13:41:28 -0800

Hello All,

In reviewing source code in snort-3.0.0a4, I found a redundant
call to fseek() in u2spewfoo.cc, which could be better written by
using a temporary variable to save the return value from fseek()
and checking that for a value < 0.  The patch file to address/correct
this is below:

--- u2spewfoo.cc.orig   2016-02-04 09:52:45.165698498 -0800
+++ u2spewfoo.cc        2016-02-04 09:55:41.211072960 -0800
@@ -105,8 +105,9 @@

     if ( s_off )
     {
-        fseek(it->file, s_pos+s_off, SEEK_SET);
-        if (fseek(it->file, s_pos+s_off, SEEK_SET))
+        int result;
+        result = fseek(it->file, s_pos+s_off, SEEK_SET);
+        if (result < 0)
         {
             puts("Unable to SEEK on current file .. and this is not being
handled yet.");
             return false;

this adjusts the code so that only a single call to fseek() is
made.

This redundant call to fseek() is NOT present in Snort-2.9.7.x/2.9.8.x

I am attaching the patch file to this bug report...

Bill Parker (wp02855 at gmail dot com)

Attachment: u2spewfoo.cc.patch
Description:

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Snort-devel mailing list
Snort-devel () lists sourceforge net
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!

Current thread: