alpine 3.9
format weakness #3


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.9 format weakness.

 			g_warning (fe->message);
			(fe == NULL) ? NULL : (fe = (g_error_free (fe), NULL));
	if (_inner_error_ != NULL) {
		(r == NULL) ? NULL : (r = (g_hash_table_unref (r), NULL));
		g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, _inner_error_->message);
		g_clear_error (&_inner_error_);
		return NULL;
	result = r;
	return result;

static gint epr_cmd_help (Epr* self, char*** args, int* args_length1, GOptionContext* opt_context, GError** error) {
	gint result;
	char* _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (opt_context != NULL, 0);
	g_option_context_add_main_entries (opt_context, EPR_help_options, NULL);
	epr_parse_args (opt_context, &(*args), &(*args_length1), TRUE);
	_tmp0_ = NULL;
	fprintf (stdout, _tmp0_ = g_option_context_get_help (opt_context, FALSE, NULL));
	_tmp0_ = (g_free (_tmp0_), NULL);
	if (epr_help_all) {
		GHashTable* cmds;
		cmds = epr_list_other_cmd (self);
		if (g_hash_table_size (cmds) > 0) {
			fprintf (stdout, "Other commands:\n");
				GList* c_collection;
				GList* c_it;
				c_collection = g_hash_table_get_keys (cmds);
				for (c_it = c_collection; c_it != NULL; c_it = c_it->next) {
					const char* c;
					c = (const char*) c_it->data;
						char* _tmp2_;
						char* _tmp1_;
						_tmp2_ = NULL;
						_tmp1_ = NULL;
						fprintf (stdout, _tmp2_ = g_strconcat (_tmp1_ = g_strconcat ("  ", c, NULL), "\n", NULL));
						_tmp2_ = (g_free (_tmp2_), NULL);
						_tmp1_ = (g_free (_tmp1_), NULL);
				(c_collection == NULL) ? NULL : (c_collection = (g_list_free (c_collection), 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.