fedora 24
buffer weakness #1

5

Weakness Breakdown


Definition:

Buffer overflows are one of the most well-known software vulnerabilities. Even though most developers know what buffer overflows are, attacks against the vulnerabilities are common in both legacy and newer applications. A classic buffer overflow exploit begins with the attacker sending data to a program, which it then stores in an undersized stack buffer. Besides stack buffer overflows, other kinds of buffer overflows include heap overflows, off-by-one errors and many others. Learn more about buffer overflows on OWASP attack index.

Warning code(s):

Easily used incorrectly.

File Name:

apachetop-0.15.6/src/apachetop.cc

Context:

The highlighted line of code below is the trigger point of this particular Fedora 24 buffer weakness.

 #else
	    '-',
#endif /* }}} */
	    (POLLING_METHOD == USING_KQUEUE ? "kqueue" :
	        (POLLING_METHOD == USING_FAM ? "fam" :
	            "stat"
		)
	    )
	    
	    );

	return;
} /* }}} */

int dprintf(const char *fmt, ...) /* {{{ */
{
	FILE *d;
        va_list args;
        static char fileName[1024] = {'\0'};

       	if ( !strlen( fileName ) )
      	{
        	strcpy( fileName, "/tmp/atop.XXXXXX" );
        	mkdtemp( fileName );
        	strncat( fileName, "/debug", sizeof(fileName ) );
       	}

        if (cf.debug && (d = fopen(fileName, "a")))
        {
                va_start(args, fmt);
                vfprintf(d, fmt, args);
		fclose(d);
        	va_end(args);
	}

        return 0;
} /* }}} */

static void catchsig(int s) /* {{{ */
{
	cf.exit = s;
} /* }}} */

/* handle a window resize by simply reopening and redrawing our window */
static void catchwinch(int s)
{
	endwin();
	refresh();
	cf.do_immed_display = true;
} 

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.