centos 7
obsolete weakness #294

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/prog/mouse-test.c

Context:

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

    }

   *current=malloc(sizeof(struct device));
   if (!*current) gpm_report(GPM_PR_OOPS,"malloc()");
   (*current)->name=strdup(name);
   if (!(*current)->name) gpm_report(GPM_PR_OOPS,"malloc()");
   (*current)->fd=fd;
   (*current)->next=NULL;
   devcount++;
   return &((*current)->next);
}

Gpm_Type *(*I_serial)(int fd, unsigned short flags, struct Gpm_Type *type,
		      int argc, char **argv);


/*----------------------------------------------------------------------------- 
   Place the description here.
 -----------------------------------------------------------------------------*/
int mousereopen(int oldfd, char *name, Gpm_Type *type)
{
   int fd;
   if (!type) type=mice+1; /* ms */
   close(oldfd);
   usleep(100000);
   fd=open(name,O_RDWR);
   if (fd < 0) gpm_report(GPM_PR_OOPS,name);
   (*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */
   return fd;
}

int noneofthem(void)
{
   noraw();
   printf("\n\nSomething went wrong, I didn't manage to detect your"
	 "protocol\n\nFeel free to report your problems to the author\n");
   exit(1);
}

#define CHECKFAIL(count)   ((count)==0 && noneofthem())

/***************************************
 * This is the most useful function in
 * the program: it build an array
 * of data characters in order to run
 * several protocols on the returned
 * data.
 */

int eventlist(int fd, char *buff, int buflen, int test, int readstep) 

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.