fedora 25
buffer weakness #23

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:

7kaa-2.14.6/src/common/OSTR.cpp

Context:

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

    return *this;
}

String& String::operator=(long value)
{
   strncpy(str_buf, misc.format(value), MAX_STR_LEN);
   str_buf[MAX_STR_LEN] = '\0';

   return *this;
}
//---------- End of operator= functions -----------//


//-------- Begin of operator+= functions -----------//

String& String::operator+=(String& s)
{
   strncat( str_buf, s.str_buf, MAX_STR_LEN );
   str_buf[MAX_STR_LEN] = '\0';
   return *this;
}

String& String::operator+=(char *s)
{
   strncat( str_buf, s, MAX_STR_LEN );
   str_buf[MAX_STR_LEN] = '\0';
   return *this;
}

String& String::operator+=(const char *s)
{
   strncat( str_buf, s, MAX_STR_LEN );
   str_buf[MAX_STR_LEN] = '\0';
   return *this;
}

String& String::operator+=(long value)
{
   strncat( str_buf, misc.format(value), MAX_STR_LEN );
   str_buf[MAX_STR_LEN] = '\0';
   return *this;
}

//---------- End of operator+= functions -----------//


//-------- Begin of operator*= functions -----------//

String& String::operator*=(int n)
{ 

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.