fedora 23
format weakness #39

4

Weakness Breakdown


Definition:

A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:

apitrace-7.1/common/os_posix.cpp

Context:

The highlighted line of code below is the trigger point of this particular Fedora 23 format weakness.

     }
}

static volatile bool logging = false;

#ifndef HAVE_EXTERNAL_OS_LOG
void
log(const char *format, ...)
{
    logging = true;
    va_list ap;
    va_start(ap, format);
    fflush(stdout);
#ifdef ANDROID
    __android_log_vprint(ANDROID_LOG_DEBUG, "apitrace", format, ap);
#else
    static FILE *log = NULL;
    if (!log) {
        // Duplicate stderr file descriptor, to prevent applications from
        // redirecting our debug messages to somewhere else.
        //
        // Another alternative would be to log to /dev/tty when available.
        log = fdopen(dup(STDERR_FILENO), "at");
    }
    vfprintf(log, format, ap);
    fflush(log);
#endif
    va_end(ap);
    logging = false;
}
#endif /* !HAVE_EXTERNAL_OS_LOG */

#if defined(__APPLE__)
long long timeFrequency = 0LL;
#endif

void
abort(void)
{
    _exit(1);
}


void
breakpoint(void)
{
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
    asm("int3");
#else
    kill(getpid(), SIGTRAP); 

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.