After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666422 - Unreachable code in gio gnetworkmonitornetlink.c
Unreachable code in gio gnetworkmonitornetlink.c
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-12-17 20:59 UTC by Mike Mueller
Modified: 2011-12-19 20:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sentry error screenshot (115.07 KB, image/png)
2011-12-17 20:59 UTC, Mike Mueller
Details

Description Mike Mueller 2011-12-17 20:59:31 UTC
Created attachment 203750 [details]
Sentry error screenshot

We've been running Sentry (our static analysis tool) on glib and recently came across this bug in read_netlink_messages:

  len = g_socket_receive_message (nl->priv->sock, NULL, &iv, 1,
                                  NULL, NULL, &flags, NULL, &error);
  if (len < 0)
    {
      g_warning ("Error on netlink socket: %s", error->message);
      g_error_free (error);
      if (nl->priv->dump_networks)
        finish_dump (nl);
      return FALSE;
    }

"len" in this code is of type gsize, which is defined to be an unsigned type.  Therefore, len can never be less than zero, and this check is erroneous.  It occurs twice in read_netlink_messages, and what appears to be error-handling logic is actually dead code.

Thanks!
Mike
Comment 1 Dan Winship 2011-12-19 20:20:32 UTC
thanks, fixed in master