[lxc-devel] [lxc/lxc] c8f055: nl: avoid NULL pointer dereference

GitHub noreply at github.com
Sun Jul 29 16:46:43 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: c8f05589644d6b719e5a2c7fc548604f248be9be
      https://github.com/lxc/lxc/commit/c8f05589644d6b719e5a2c7fc548604f248be9be
  Author: Rafał Miłecki <rafal at milecki.pl>
  Date:   2018-07-29 (Sun, 29 Jul 2018)

  Changed paths:
    M src/lxc/nl.c

  Log Message:
  -----------
  nl: avoid NULL pointer dereference

It's a valid case to call nla_put() with NULL data and 0 len. It's done e.g. in
the nla_put_attr().

There has to be a check for data in nla_put() as passing NULL to the memcpy()
is not allowed. Even if length is 0, both pointers have to be valid.

For a reference see C99 standard (7.21.1/2), it says: "pointer arguments on
such a call shall still have valid values".

Reported-by: Daniel Gimpelevich <daniel at gimpelevich.san-francisco.ca.us>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
[christian.brauner at ubuntu.com: adapted commit message]
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 646b1be9bb2d9caffae1cc69c8ccd80a3e1dc40f
      https://github.com/lxc/lxc/commit/646b1be9bb2d9caffae1cc69c8ccd80a3e1dc40f
  Author: Christian Brauner <christian at brauner.io>
  Date:   2018-07-29 (Sun, 29 Jul 2018)

  Changed paths:
    M src/lxc/nl.c

  Log Message:
  -----------
  Merge pull request #2497 from brauner/2018-07-29/nl_fix

nl: avoid NULL pointer dereference


Compare: https://github.com/lxc/lxc/compare/a4f181a448b2...646b1be9bb2d
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the lxc-devel mailing list