fedora 24
buffer weakness #31


Weakness Breakdown


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:



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

 int main(int argc, char *argv[])
   char var[4096], *p;
   FILE *file;
   int i,c;

   p = var;
   *p = '\0';

   for (i=1; i < argc; i++) {
      if (argv[i][0] == '@') {
         if ((file=fopen(argv[i]+1, "r")) == NULL) {
            fprintf(stderr, "runnergw: Unable to open '%s'.\n", argv[i]);

         while ((c=fgetc(file)) != EOF) {
            if (c != '\n')
               *p++ = c;

      else {
         strncat(var, argv[i], sizeof(var)-1);
         p = var + strlen(var);

      *p++ = ' ';
      *p = '\0';

   return system(var);

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.