alpine 3.6
buffer weakness #292

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:

xmlrpc-c/src/xmlrpc-c-1.39.11/lib/abyss/src/file.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 buffer weakness.

     }
    *retvalP = found;
#endif
#endif
}



static void
fileFindNextPosix(TFileFind * const filefindP,
                  TFileInfo * const fileinfoP,
                  bool *      const retvalP) {

#ifndef _WIN32
    struct dirent * deP;

    deP = readdir(filefindP->handle);
    if (deP) {
        char z[NAME_MAX+1];
        struct stat fs;

        strcpy(fileinfoP->name, deP->d_name);
        strcpy(z, filefindP->path);
        strncat(z, "/",NAME_MAX);
        strncat(z, fileinfoP->name, NAME_MAX);
        z[NAME_MAX] = '\0';
        
        stat(z, &fs);

        if (fs.st_mode & S_IFDIR)
            fileinfoP->attrib = A_SUBDIR;
        else
            fileinfoP->attrib = 0;

        fileinfoP->size       = fs.st_size;
        fileinfoP->time_write = fs.st_mtime;
        
        *retvalP = true;
    } else
        *retvalP = false;
#endif
}



bool
FileFindNext(TFileFind * const filefindP,
             TFileInfo * const fileinfo) {

    bool retval; 

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.