Show
Ignore:
Timestamp:
06/08/09 21:12:46 (3 years ago)
Author:
Neutron Soutmun <neo.neutron@…>
Children:
bae014d9f22e13f6115d53d154e6489f20ae00e4
Parents:
5987af1b79b0c1fbd4aa9d30a53ec6879853ece3
git-committer:
Neutron Soutmun <neo.neutron@…> (06/08/09 21:12:46)
Message:

Follow the flawfinder guideline

  • Reduce the vulnerability code by follow the advice of flawfinder.
  • Just finish one of the TODO lists.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/rh-ipset.c

    raace70f r927d0c7  
    122122  req_adt_get.op = IP_SET_OP_ADT_GET; 
    123123  req_adt_get.version = IP_SET_PROTOCOL_VERSION; 
    124   strcpy(req_adt_get.set.name, name); 
     124  strncpy(req_adt_get.set.name, name, IP_SET_MAXNAMELEN); 
    125125  size = sizeof(struct ip_set_req_adt_get); 
    126126 
     
    150150{ 
    151151  unsigned int i = 0; 
     152  if (!mac) 
     153    return; 
     154 
    152155  if (strlen(mac) != ETH_ALEN * 3 - 1) 
    153156    return; 
     
    181184  static char mac_string[18] = ""; 
    182185  
    183   sprintf(mac_string, "%02X:%02X:%02X:%02X:%02X:%02X",  
     186  snprintf(mac_string, sizeof (mac_string), "%02X:%02X:%02X:%02X:%02X:%02X",  
    184187          macaddress[0], macaddress[1], macaddress[2], 
    185188          macaddress[3], macaddress[4], macaddress[5]); 
     
    261264  req.op = IP_SET_OP_FLUSH; 
    262265  req.version = IP_SET_PROTOCOL_VERSION; 
    263   strcpy(req.name, name); 
     266  strncpy(req.name, name, IP_SET_MAXNAMELEN); 
    264267 
    265268  kernel_sendto(&req, sizeof(struct ip_set_req_std)); 
     
    288291  req_max_sets.op = IP_SET_OP_MAX_SETS; 
    289292  req_max_sets.version = IP_SET_PROTOCOL_VERSION; 
    290   strcpy(req_max_sets.set.name, name); 
     293  strncpy(req_max_sets.set.name, name, IP_SET_MAXNAMELEN); 
    291294  size = sizeof(req_max_sets); 
    292295  kernel_getfrom(&req_max_sets, &size);