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.
Easily used incorrectly.
v4l-utils-0.9.5/lib/libdvbv5/descriptors.c
The highlighted line of code below is the trigger point of this particular Centos 7 buffer weakness.
} while (len > 0);
return 0;
}
void hexdump(struct dvb_v5_fe_parms *parms, const char *prefix, const unsigned char *data, int length)
{
if (!data)
return;
char ascii[17];
char hex[50];
int i, j = 0;
hex[0] = '\0';
for (i = 0; i < length; i++)
{
char t[4];
snprintf (t, sizeof(t), "%02x ", (unsigned int) data[i]);
strncat (hex, t, sizeof(hex));
if (data[i] > 31 && data[i] < 128 )
ascii[j] = data[i];
else
ascii[j] = '.';
j++;
if (j == 8)
strncat(hex, " ", sizeof(hex));
if (j == 16)
{
ascii[j] = '\0';
dvb_log("%s%s %s", prefix, hex, ascii);
j = 0;
hex[0] = '\0';
}
}
if (j > 0 && j < 16)
{
char spaces[47];
spaces[0] = '\0';
for (i = strlen(hex); i < 49; i++)
strncat(spaces, " ", sizeof(spaces));
ascii[j] = '\0';
dvb_log("%s%s %s %s", prefix, hex, spaces, ascii);
}
/*int i, j;*/
/*char tmp[64];*/
/*char ascii[32];*/
/*for (i = 0, j = 0; i < len; i++, j++) {*/
/*if (i && !(i % 16)) {*/
/*dvb_log("%s%s", prefix, tmp);*/
/*j = 0;*/