NULL check some g_log statements for extcap.

"Yes, on *most* UN*Xes, that causes "(null)" to be printed, but it causes a crash on at
least some versions of Solaris, so Don't Do It." - Guy Harris

Bug: 14194
Change-Id: Iff0d59803d78b1e87a564e8bcdc5c84af485eea6
Reviewed-on: https://code.wireshark.org/review/24922
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-12-20 19:23:21 -05:00
parent 530fd0a4d0
commit bb5ade02d5

View File

@ -1614,14 +1614,17 @@ static gboolean cb_load_interfaces(extcap_callback_info_t cb_info)
{
int_iter = (extcap_interface *)walker->data;
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Interface found %s\n", int_iter->call);
if (int_iter->call != NULL)
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Interface found %s\n", int_iter->call);
/* Help is not necessarily stored with the interface, but rather with the version string.
* As the version string allways comes in front of the interfaces, this ensures, that it get's
* properly stored with the interface */
if (int_iter->if_type == EXTCAP_SENTENCE_EXTCAP)
{
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, " Extcap [%s] ", int_iter->call);
if (int_iter->call != NULL)
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, " Extcap [%s] ", int_iter->call);
/* Only initialize values if none are set. Need to check only one element here */
if ( ! element->version )
{
@ -1655,8 +1658,8 @@ static gboolean cb_load_interfaces(extcap_callback_info_t cb_info)
continue;
}
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, " Interface [%s] \"%s\" ",
int_iter->call, int_iter->display);
if ((int_iter->call != NULL) && (int_iter->display))
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, " Interface [%s] \"%s\" ", int_iter->call, int_iter->display);
int_iter->extcap_path = g_strdup(cb_info.extcap);