Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

fedora 25
misc weakness #433

4

Weakness Breakdown


Definition:

The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:

gnomint-1.2.1/src/pkey_manage.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 25 misc weakness.

 
	return password;
}


gboolean pkey_manage_filechooser_file_set_cb (GtkFileChooserButton *widget, gpointer user_data)
{
	GtkWidget *remember_filepath_widget = NULL;

	remember_filepath_widget = g_object_get_data (G_OBJECT(widget), "save_filename_checkbutton");
	g_object_set (G_OBJECT(remember_filepath_widget), "visible", TRUE, NULL);

	return FALSE;
}

#else
gchar * __pkey_manage_ask_external_file_password (const gchar *cert_dn)
{
	gchar *password;
	gchar *aux = NULL;


	printf (_("The file that holds private key for certificate\n'%s' is password-protected.\n\n"), cert_dn);

	aux = getpass ("Please, insert the password corresponding to this file:");
	
	if (!aux || aux[0] == '\0') {
		return NULL;
	} else {
		password = g_strdup (aux);
		memset (aux, 0, strlen(aux));
	}
	
	return password;
}

#endif

gchar * __pkey_retrieve_from_file (gchar **fn, gchar *cert_pem)
{
	gsize file_length = 0;
	GError *error = NULL;
	gboolean cancel = FALSE;

	gboolean save_new_filename = FALSE;
	gchar *file_name = g_strdup(* fn);

	gchar *file_contents = NULL;

	gchar *pem_pkey = NULL; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.