GNOME Bugzilla – Bug 666422
Unreachable code in gio gnetworkmonitornetlink.c
Last modified: 2011-12-19 20:20:32 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
thanks, fixed in master