alpine 3.9
format weakness #19

4

Weakness Breakdown


Definition:

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:

libidl/src/libIDL-0.8.14/util.c

Context:

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

 #define literalsbit		1
	guint literals : 1;

#define inline_propsbit		2
	guint inline_props : 1;

#define su_defbit		3
	guint su_def : 1;
} IDL_output_data;

static void dataf (IDL_output_data *data, const char *fmt, ...)
G_GNUC_PRINTF (2, 3);

static void idataf (IDL_output_data *data, const char *fmt, ...)
G_GNUC_PRINTF (2, 3);

static void dataf (IDL_output_data *data, const char *fmt, ...)
{
	gchar *buffer;
	va_list args;

	va_start (args, fmt);
	switch (data->mode) {
	case OUTPUT_FILE:
		vfprintf (data->u.o, fmt, args);
		break;

	case OUTPUT_STRING:
		buffer = g_strdup_vprintf (fmt, args);
		g_string_append (data->u.s, buffer);
		g_free (buffer);
		break;

	default:
		break;
	}
	va_end (args);
}

static void idataf (IDL_output_data *data, const char *fmt, ...)
{
	gchar *buffer;
	va_list args;

	va_start (args, fmt);
	doindent ();
	switch (data->mode) {
	case OUTPUT_FILE:
		vfprintf (data->u.o, fmt, args);
		break; 

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.