[ovs-git] [openvswitch/ovs] 3df52f: lldp: fix string warnings

GitHub noreply at github.com
Thu Jun 14 20:22:36 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 3df52f3d14e8cab704a918dd92e076804c0815e1
      https://github.com/openvswitch/ovs/commit/3df52f3d14e8cab704a918dd92e076804c0815e1
  Author: Aaron Conole <aconole at redhat.com>
  Date:   2018-06-14 (Thu, 14 Jun 2018)

  Changed paths:
    M lib/lldp/lldpd.c

  Log Message:
  -----------
  lldp: fix string warnings

lib/lldp/lldpd.c: In function :
lib/lldp/lldpd.c:520:17: warning:  output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
          strncat(buffer, cfg->g_protocols[i].name,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          strlen(cfg->g_protocols[i].name));
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/lldp/lldpd.c: In function :
lib/lldp/lldpd.c:519:17: warning:  specified bound 2 equals source length [-Wstringop-overflow=]
          strncat(buffer, ", ", 2);
          ^~~~~~~~~~~~~~~~~~~~~~~~

Closer inspection shows that buffer is only used to output protocol names
when debug logging is enabled, so restructure the code a bit as well.

Signed-off-by: Aaron Conole <aconole at redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng at gmail.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>



      **NOTE:** This service 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 git mailing list