alpine 3.7
integer weakness #5


Weakness Breakdown


An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.7 integer weakness.

  struct sigaction act;
  sigset_t empty_mask;
  sigset_t full_mask;

  CORBA_Environment ev;
  CORBA_ORB orb;
  gchar* ior;
  DBusConnection *connection;

  int dev_null_fd;
  int exit_code = 0;
  int write_byte_fd;

  _gconf_init_i18n ();
  setlocale (LC_ALL, "");
  textdomain (GETTEXT_PACKAGE);
  /* Now this is an argument parser */
  if (argc > 1)
    write_byte_fd = atoi (argv[1]);
    write_byte_fd = -1;
  /* This is so we don't prevent unmounting of devices. We divert
   * all messages to syslog
  if (g_chdir ("/") < 0)
       g_printerr ("Could not change to root directory: %s\n",
		   g_strerror (errno));
       exit (1);

  if (!g_getenv ("GCONF_DEBUG_OUTPUT"))
      dev_null_fd = open (DEV_NULL, O_RDWR);
      if (dev_null_fd >= 0)
	  dup2 (dev_null_fd, 0);
	  dup2 (dev_null_fd, 1);
	  dup2 (dev_null_fd, 2);

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.