erf: set USERAPPL if we have the application version but not the name.

Just say "(Unknown application) <version>".

This also means that we don't leak the app_version string if there's no
app_name string.
This commit is contained in:
Guy Harris 2021-05-23 19:37:09 -07:00
parent c4aa583d8e
commit 297b6c5407
1 changed files with 7 additions and 4 deletions

View File

@ -2607,10 +2607,13 @@ static int populate_capture_host_info(erf_t *erf_priv, wtap *wth, union wtap_pse
/* Post processing */
if (app_name) {
/* If no app_version will just use app_name */
tmp = g_strjoin(" ", app_name, app_version, NULL);
if (app_name || app_version) {
/*
* If we have no app_name, we use "(Unknown applicaton)".
*
* If we have no app_version, this will just use app_name.
*/
tmp = g_strjoin(" ", app_name ? app_name : "(Unknown application)", app_version, NULL);
wtap_block_set_string_option_value(shb_hdr, OPT_SHB_USERAPPL, tmp, strlen(tmp));
g_free(tmp);