Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] missing sanity check in TCP Replay. #84

Closed
dogbert2 opened this issue Jun 11, 2014 · 1 comment
Closed

[PATCH] missing sanity check in TCP Replay. #84

dogbert2 opened this issue Jun 11, 2014 · 1 comment
Assignees
Milestone

Comments

@dogbert2
Copy link

Hello All,

In reviewing code in tcpreplay-4.0.4, in directory 'compat', I found
some instances where calls to malloc() are not checked for a return
value of NULL, indicating failure. This is in file 'pathfind.c' and
the patch file below adds the sanity check:

--- pathfind.c.orig 2014-06-10 16:55:00.296402796 -0700
+++ pathfind.c  2014-06-10 16:59:36.459501706 -0700
@@ -170,6 +170,8 @@
     } else {
         if (dot_path && dot_path[0]) {
             result = malloc( 2 + strlen( dot_path ) + strlen( string ) );
+       if (result == NULL) /* oops, malloc() failed */
+       goto make_absolute_done;
             strcpy( result, dot_path );
             result_len = strlen( result );
             if (result[result_len - 1] != '/') {
@@ -178,6 +180,8 @@
             }
         } else {
             result = malloc( 3 + strlen( string ) );
+       if (result == NULL) /* oops, malloc() failed */
+       goto make_absolute_done;
             result[0] = '.'; result[1] = '/'; result[2] = '\0';
             result_len = 2;
         }
@@ -185,6 +189,7 @@
         strcpy( result + result_len, string );
     }

+make_absolute_done:
     return result;
 }

I am attaching the patch file to this bug report.

Bill Parker (wp02855 at gmail dot com)

@fklassen fklassen added this to the 4.0.5 milestone Jun 11, 2014
@fklassen fklassen self-assigned this Jun 11, 2014
@fklassen
Copy link
Member

Thanks for the bug report. Fix is scheduled for 4.0.5.

fklassen added a commit that referenced this issue Jul 22, 2014
Added missing sanity check in libopts - closes #84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants