Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/xserver-xorg-input-mouse-1.9.3/src/compat-api.h
Examining data/xserver-xorg-input-mouse-1.9.3/src/mouse.h
Examining data/xserver-xorg-input-mouse-1.9.3/src/hurd_mouse.c
Examining data/xserver-xorg-input-mouse-1.9.3/src/mousePriv.h
Examining data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c
Examining data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c
Examining data/xserver-xorg-input-mouse-1.9.3/src/sun_mouse.c
Examining data/xserver-xorg-input-mouse-1.9.3/src/mouse.c
Examining data/xserver-xorg-input-mouse-1.9.3/src/pnp.c
Examining data/xserver-xorg-input-mouse-1.9.3/include/xf86-mouse-properties.h

FINAL RESULTS:

data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c:120:17:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
            i = readlink(dev, realdev, PATH_MAX);
data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c:137:13:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
            sprintf(tmp, "/dev/%s", realdev);
data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c:262:14:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) {
data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c:284:23:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c:367:22:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK));
data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c:506:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char map[MSE_MAXBUTTONS + 1];
data/xserver-xorg-input-mouse-1.9.3/src/hurd_mouse.c:131:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(eventList, event, remainder);
data/xserver-xorg-input-mouse-1.9.3/src/hurd_mouse.c:190:19:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    SYSCALL (fd = open(path, O_RDWR | O_NONBLOCK | O_EXCL));
data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c:71:23:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL));
data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c:157:23:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL));
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1711:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char map[MSE_MAXBUTTONS + 1];
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1918:15:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static signed char stateTab[11][5][3] = {
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2022:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char reverseMap[16] = { 0,  4,  2,  6,
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2027:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char hitachMap[16] = {  0,  2,  1,  3,
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2549:17:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static unsigned char proto[PROT_NUMPROTOS][8] = {
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2981:26:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
                unsigned char c2[2];
data/xserver-xorg-input-mouse-1.9.3/src/mouse.h:233:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char       protoBuf[8];
data/xserver-xorg-input-mouse-1.9.3/src/mouse.h:234:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char       protoPara[8];
data/xserver-xorg-input-mouse-1.9.3/src/mousePriv.h:57:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char        data[NUM_MSE_AUTOPROBE_TOTAL];
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:156:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buf[256];      /* PnP ID string may be up to 256 bytes long */
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:377:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char s[3];
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:483:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
        sprintf(s, "%02X", sum & 0x0ff);
data/xserver-xorg-input-mouse-1.9.3/src/sun_mouse.c:666:23:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
        SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
data/xserver-xorg-input-mouse-1.9.3/src/bsd_mouse.c:577:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(300000);
data/xserver-xorg-input-mouse-1.9.3/src/lnx_mouse.c:136:34:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
            char *tmp = xnfalloc(strlen(realdev) + 5 + 1);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1127:37:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                                    strlen(XI_PROP_DEVICE_NODE), TRUE);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1130:32:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                               strlen(device_node), device_node, FALSE);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1156:49:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    prop_mbemu = MakeAtom(MOUSE_PROP_MIDBUTTON, strlen(MOUSE_PROP_MIDBUTTON),
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:1166:31:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
                              strlen(MOUSE_PROP_MIDBUTTON_TIMEOUT), TRUE);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2764:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2767:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2770:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2773:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2778:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2815:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2828:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2830:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2832:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2834:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2836:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2838:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2850:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2856:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2870:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(100000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2878:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(50000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2966:21:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
                    usleep(30000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:2973:17:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
                usleep(30000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:3029:17:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
                usleep(30000);
data/xserver-xorg-input-mouse-1.9.3/src/mouse.c:3053:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(30000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:254:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:264:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:267:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:280:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:302:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(200000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:321:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(200000);     /* the mouse must send `Begin ID' within 200msec */
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:596:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(10000);
data/xserver-xorg-input-mouse-1.9.3/src/pnp.c:650:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(30000);
data/xserver-xorg-input-mouse-1.9.3/src/sun_mouse.c:295:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        n = read(pInfo->fd, pBuf, sizeof(Firm_event));

ANALYSIS SUMMARY:

Hits = 58
Lines analyzed = 7169 in approximately 0.19 seconds (37360 lines/second)
Physical Source Lines of Code (SLOC) = 5253
Hits@level = [0]   5 [1]  35 [2]  21 [3]   0 [4]   1 [5]   1
Hits@level+ = [0+]  63 [1+]  58 [2+]  23 [3+]   2 [4+]   2 [5+]   1
Hits/KSLOC@level+ = [0+] 11.9931 [1+] 11.0413 [2+] 4.37845 [3+] 0.380735 [4+] 0.380735 [5+] 0.190367
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.