fedora 25
format weakness #20


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 Fedora 25 format weakness.

 * rle - read in a Utah RLE Toolkit type image.
 * Author:	Graeme Gill
 * Date: 	30/5/90
 * Bugs - doesn't free up memory used by rle functions.

#undef  DEBUG

#ifdef DEBUG
# define debug(xx)	fprintf(stderr,xx)
# define debug(xx)

#define MIN(a,b) ( (a)<(b) ? (a) : (b))

#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "image.h"
#include "rle.h"

void dithermap();

/* input file stuff */
static int ptype;				/* picture type : */
#define BW_NM	0		/* black and white, no map */
#define BW_M	1		/* black and white, and a map */
#define SC_M	2		/* single colour channel and colour map */
#define C_NM	3		/* full colour, no maps */
#define C_M	4		/* full colour with colour maps */
static rle_pixel **fmaps;	/* file colour maps from buildmap() */
static unsigned char **scan;	/* buffer for input data */
static int x_min;		/* copy of picture x_min */
static int y_min;		/* copy of picture y_min */

/* option stuff (Not functional) */
static float disp_gam = 1.0;	/* default display gamma correction factor */
static int iflag=0;			/* user suplied image gamma */
static float img_gam = 1.0;			/* image gamma */
static int bwflag = 0;			/* black and white flag */
static int gammamap[256];
static int background[3] = {0,0,0};	/* our background colour */

/* stuff for dithering colour pictures */ 

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.