centos 6
format weakness #17

4

Weakness Breakdown


Definition:

A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always 0-terminate.

File Name:

gpm-1.20.6/src/synaptics.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 6 format weakness.

 #if DEBUG_REPORTS
  tp_dump_report_data (*report, edges, state);
#endif

}


/*
** syn_read_config_file
**
** Read the configuration data from the global config file
** SYSCONFDIR "/gpm-syn.conf".
*/
void tp_read_config_file (char* config_filename) 
{
  char line [80];
  char *token;
  char *end_ptr;
  int  param, tmp_read_int_param;
  FILE *config;
  char full_filename[100];
  int  status;
  float tmp_read_float_param;

  status = snprintf(full_filename,100,SYSCONFDIR "/%s",config_filename);
  if (status < 0) {
    gpm_report (GPM_PR_WARN,"Too long path for configure file: %s", config_filename); 
    return;
  }


  if ( !(config = fopen (full_filename, "r")) ) {
    gpm_report (GPM_PR_WARN,"Failed to open configfile: %s", full_filename);    
  }else{
    while (fgets (line, 80, config)) {
      if (line [0] == '[') {
	if ( (token = strtok (line, "[] \t")) ) {
	  param = 0;

	  /* which param is it */
	  while (param_data [param].name &&
		 strcasecmp (token, param_data [param].name) != 0) {
	    param++;
	  }

	  /* was a param found? */
	  if (!param_data [param].name) {
	    gpm_report (GPM_PR_WARN,"Unknown parameter %s", token);
	  } else {
	    token = strtok (NULL, "[] \t"); 

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.