fedora 23
format weakness #5

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):

Potential format string problem.

File Name:

atanks-6.4/src/debug.h

Context:

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

 #endif // BSD

#if defined(__linux__) || defined(__linux) || defined(linux) || defined(ATANKS_IS_BSD)
# define ATANKS_IS_LINUX
#endif // Linux

#if !defined(ATANKS_IS_WINDOWS) && !defined(ATANKS_IS_LINUX)
# error "Only Windows, Linux and BSD are supported at the moment"
#endif // Windows versus Linux


/**********************************************************
 * Define some macros to work around compiler differences *
 *********************************************************/
#if defined(ATANKS_IS_MSVC)
# define atanks_snprintf(target, char_count, fmt, ...) \
    _snprintf_s(target, char_count + 1, char_count, fmt, __VA_ARGS__)
# define atanks_tzset() _tzset()
# define atanks_localtime(tm_p, time_p) localtime_s(tm_p, time_p)
#else
# define atanks_snprintf(target, char_count, fmt, ...) \
    snprintf(target, char_count, fmt, __VA_ARGS__)
# define atanks_tzset() tzset()
# define atanks_localtime(tm_p, time_p) localtime_r(time_p, tm_p)
# define vsprintf_s(tgt, size, fmt, listvar) vsprintf(tgt, fmt, listvar)
#endif // MSVC++ versus GCC/Clang


// Windows special definitions
#if defined(ATANKS_IS_WINDOWS)
# ifndef WIN32_LEAN_AND_MEAN
#   define WIN32_LEAN_AND_MEAN
# endif

# ifndef WIN32_EXTRA_LEAN
#   define WIN32_EXTRA_LEAN
# endif

# ifndef VC_EXTRALEAN
#   define VC_EXTRALEAN
# endif

# define NOMINMAX

#endif // IS_WINDOWS


/// ==============================================================
/// === The following is only used if ATANKS_DEBUG is defined. ===
/// === Otherwise the macro DEBUG_LOG() does nothing.          === 

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.