alpine 3.6
format weakness #97


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.6 format weakness.

	/* only abort if no filter was set, that's a bug */
	if (!device_filtered)
		litest_abort_msg("Invalid test device type");

static void
litest_log_handler(struct libinput *libinput,
		   enum libinput_log_priority pri,
		   const char *format,
		   va_list args)
	const char *priority = NULL;

	switch(pri) {
	case LIBINPUT_LOG_PRIORITY_INFO: priority = "info"; break;
	case LIBINPUT_LOG_PRIORITY_ERROR: priority = "error"; break;
	case LIBINPUT_LOG_PRIORITY_DEBUG: priority = "debug"; break;

	fprintf(stderr, "litest %s: ", priority);
	vfprintf(stderr, format, args);

	if (strstr(format, "client bug: ") ||
	    strstr(format, "libinput bug: "))
		litest_abort_msg("libinput bug triggered, aborting.\n");

static char *
litest_init_device_udev_rules(struct litest_test_device *dev);

static void
litest_init_all_device_udev_rules(struct list *created_files)
	struct litest_test_device **dev = devices;

	while (*dev) {
		char *udev_file;

		udev_file = litest_init_device_udev_rules(*dev);
		if (udev_file) {
			struct created_file *file = zalloc(sizeof(*file));
			file->path = udev_file;
			list_insert(created_files, &file->link);

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.