alpine 3.9
misc weakness #437


Weakness Breakdown


The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.9 misc weakness.

 #  endif
#   undef putc_unlocked
#   define putc_unlocked(c,stream) putc (c, stream)
#  endif
# endif

/* It is desirable to use this bit on systems that have it.
   The only bit of terminal state we want to twiddle is echoing, which is
   done in software; there is no need to change the state of the terminal
   hardware.  */

# ifndef TCSASOFT
#  define TCSASOFT 0
# endif

static void
call_fclose (void *arg)
  if (arg != NULL)
    fclose (arg);

char *
getpass (const char *prompt)
  FILE *tty;
  FILE *in, *out;
  struct termios s, t;
# endif
  bool tty_changed = false;
  static char *buf;
  static size_t bufsize;
  ssize_t nread;

  /* Try to write to and read from the terminal if we can.
     If we can't open the terminal, use stderr and stdin.  */

  tty = fopen ("/dev/tty", "w+");
  if (tty == NULL)
      in = stdin;
      out = stderr;
      /* We do the locking ourselves.  */
      __fsetlocking (tty, FSETLOCKING_BYCALLER);

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.