fedora 24
format weakness #43

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, and note that sprintf variations do not always 0-terminate.

File Name:

GeoIP-1.6.11/libGeoIP/GeoIP.c

Context:

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

  * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "GeoIP.h"
#include "GeoIP_internal.h"

static geoipv6_t IPV6_NULL;

#if defined(_WIN32)
#include <io.h>

#ifdef _MSC_VER
#  if _MSC_VER < 1900 // VS 2015 supports snprintf
#    define snprintf _snprintf
#  endif
#  if _MSC_VER >= 1400 // VS 2005+ deprecates fileno, lseek and read
#    define fileno _fileno
#    define read _read
#    define lseek _lseek
#  endif
#endif
#else
#include <unistd.h>
#include <netdb.h>
#include <sys/mman.h>
#endif /* defined(_WIN32) */

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h> /* for fstat */
#include <sys/stat.h>  /* for fstat */

#ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h> /* for gettimeofday */
#endif
 

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.