centos 7
obsolete weakness #288

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

gpm-1.20.7/src/mice.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 obsolete weakness.

    for (i=0;(which_mouse->opt_sample)<=sampletab[i].sample;i++) ;
   write(fd,sampletab[i].code,1);
   return type;
}

/* wacom graphire tablet */
#define UD_RESETBAUD     "\r$ "      /* reset baud rate to default (wacom V) */
                                    /* or switch to wacom IIs (wacomIV)     */ 
#define UD_RESET         "#\r"      /* Reset tablet and enable WACOM IV     */
#define UD_SENDCOORDS    "ST\r"     /* Start sending coordinates            */
#define UD_FIRMID        "~#\r"     /* Request firmware ID string           */
#define UD_COORD         "~C\r"     /* Request max coordinates              */
#define UD_STOP          "\nSP\r"   /* stop sending coordinates             */

static void I_wacom_reset_wacom(int fd)
{
   /* Init Wacom communication; this is modified from xf86Wacom.so module */
   /* Set speed to 19200 */
   setspeed (fd, 1200, 19200, 0, B19200|CS8|CREAD|CLOCAL|HUPCL);
   /* Send Reset Baudrate Command */
   write(fd, UD_RESETBAUD, strlen(UD_RESETBAUD));
   usleep(250000);
   /* Send Reset Command */
   write(fd, UD_RESET,     strlen(UD_RESET));
   usleep(75000);
   /* Set speed to 9600bps */
   setspeed (fd, 1200, 9600, 0, B9600|CS8|CREAD|CLOCAL|HUPCL);
   /* Send Reset Command */
   write(fd, UD_RESET, strlen(UD_RESET));
   usleep(250000);
   write(fd, UD_STOP, strlen(UD_STOP));
   usleep(100000);
}

static int I_wacom_wait_wacom(int fd)
{
   /*
    *  Wait up to 200 ms for Data from Tablet.
    *  Do not read that data.
    *  Give back 0 on timeout condition, -1 on error and 1 for DataPresent
    */
   struct timeval timeout;
   fd_set readfds;
   int err;
   FD_ZERO(&readfds);  FD_SET(fd, &readfds);
   timeout.tv_sec = 0; timeout.tv_usec = 200000;
   err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
   return((err>0)?1:err);
}
 

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.