[hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 5950: Add sanity check against netlink handle and header in netlink_talk().

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Fri, 03 Jun 2011 09:56:25 -0000

------------------------------------------------------------
revno: 5950
fixes bug(s): https://launchpad.net/bugs/790679
committer: David Martin <david.martin.mailbox@xxxxxxxxxxxxxx>
branch nick: hipl_startup
timestamp: Fri 2011-06-03 11:45:24 +0200
message:
  Add sanity check against netlink handle and header in netlink_talk().
  
  netlink_talk() should check if it gets a valid netlink handle and message
  header before it tries to access them as it is not guaranteed that they are
  properly set up. For example when the initialization fails early and the
  default policies are nevertheless attempted to be removed on exit.
  
  This fixes bug 790679 (https://bugs.launchpad.net/hipl/+bug/790679).
modified:
  lib/tool/nlink.c


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to 
https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'lib/tool/nlink.c'
--- lib/tool/nlink.c    2011-04-05 16:44:22 +0000
+++ lib/tool/nlink.c    2011-06-03 09:45:24 +0000
@@ -248,6 +248,11 @@
     nladdr.nl_pid    = peer;
     nladdr.nl_groups = groups;
 
+    if (nl == NULL || n == NULL) {
+        HIP_ERROR("Invalid netlink socket handle or message header.\n");
+        return -1;
+    }
+
     n->nlmsg_seq = seq = ++nl->seq;
 
     /* Note: the TALK_ACK are here because I experienced problems

Other related posts:

  • » [hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 5950: Add sanity check against netlink handle and header in netlink_talk(). - noreply