centos 7
integer weakness #29


Weakness Breakdown


An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:



The highlighted line of code below is the trigger point of this particular Centos 7 integer weakness.

 int	fputs(const char *, FILE *);
u_int	fread(void *, u_int, u_int, FILE *);
int	fseek(FILE *, long, int);
u_int	fwrite(const void *, u_int, u_int, FILE *);
void	rewind(FILE *);
void	setbuf(FILE *, char *);
int	setlinebuf(FILE *);
u_int	vfprintf(FILE *, const char *, char *);	/* arg 3 is really va_list */

#if __GNUC__ <= 1
int	read(int, const char *, u_int);
int	write(int, const char *, u_int);

__dead	void abort(void) __attribute__((volatile));
int	abs(int);
#ifdef	__STDC__
struct	sockaddr;
int	accept(int, struct sockaddr *, int *);
int	access(const char *, int);
u_int	alarm(u_int);
int	atoi(const char *);
long	atol(const char *);
int	bcmp(const void *, const void *, u_int);
void	bcopy(const void *, void *, u_int);
void	bzero(void *, u_int);
char	*calloc(u_int, u_int);
int	chdir(const char *);
int	chmod(const char *, int);
int	chown(const char *, int, int);
int	close(int);
int	connect(int, struct sockaddr *, int);
char	*crypt(const char *, const char *);
int	daemon(int, int);
void	endgrent(void);
void	endpwent(void);
void	endservent(void);
int	execl(const char *, ...);
int	execlp(const char *, ...);
int	execv(const char *, char * const *);
__dead	void exit(int) __attribute__((volatile));
__dead	void _exit(int) __attribute__((volatile));
int	fchmod(int, int);
int	fchown(int, int, int);
int	fcntl(int, int, int);
int	ffs(int);
int	flock(int, int);
int	fork(void); 

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.