Changeset 5028:bda7085a07b8 in roaraudio


Ignore:
Timestamp:
05/28/11 11:46:46 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

fixed some ckport warnings about poissible buffer overflows which are not possible because buffer length is ensured before the call

Location:
libroar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libroar/nnode.c

    r5008 r5028  
    206206  case ROAR_SOCKET_TYPE_INET: 
    207207    roar_mm_strscpy(proto,     "IPv4"); 
    208     sprintf(nodeaddr, "%i.%i.%i.%i", 
     208    snprintf(nodeaddr, sizeof(nodeaddr), "%i.%i.%i.%i", 
    209209                 nnode->addr.inet4[0], nnode->addr.inet4[1], 
    210210                 nnode->addr.inet4[2], nnode->addr.inet4[3] 
     
    213213  case ROAR_SOCKET_TYPE_DECNET: 
    214214    roar_mm_strscpy(proto,     "DECnet"); 
    215     sprintf(nodeaddr, "%i.%i", nnode->addr.decnet.area, nnode->addr.decnet.node); 
     215    snprintf(nodeaddr, sizeof(nodeaddr), "%i.%i", nnode->addr.decnet.area, nnode->addr.decnet.node); 
    216216   break; 
    217217  case ROAR_SOCKET_TYPE_INET6: 
     
    222222   break; 
    223223  default: 
    224     sprintf(proto, "P#%i", nnode->socktype); 
     224    snprintf(proto, sizeof(proto), "P#%i", nnode->socktype); 
    225225   break; 
    226226 } 
  • libroar/vio_proto.c

    r4843 r5028  
    448448  return NULL; 
    449449 
    450  inlen = strlen(up->user) + strlen(up->pass) + 2; 
     450 inlen = roar_mm_strlen(up->user) + roar_mm_strlen(up->pass) + 2; 
    451451 inbuf = roar_mm_malloc(inlen); 
    452452 if ( inbuf == NULL ) 
     
    454454 
    455455 inbuf[0] = 0; 
    456  strcat(inbuf, up->user); 
    457  strcat(inbuf, ":"); 
    458  strcat(inbuf, up->pass); 
     456 roar_mm_strlcat(inbuf, up->user, inlen); 
     457 roar_mm_strlcat(inbuf, ":", inlen); 
     458 roar_mm_strlcat(inbuf, up->pass, inlen); 
    459459 
    460460 outlen = ((inlen * 3) / 2) + 3 /* padding... */ + 6 /* 'Basic ' */; 
  • libroar/vio_tantalos.c

    r4708 r5028  
    8787 for (i = 0; i < cookie->matchcount; i++) { 
    8888  strncpy(url, cookie->match[i].url + ROAR_SLP_URL_TYPE_DOWNLOAD_HTTP_LEN - 4, _LEN); 
    89   strcat(url, "?key="); 
    90   strcat(url, key); 
     89  roar_mm_strscat(url, "?key="); 
     90  roar_mm_strscat(url, key); 
    9191 
    9292  ROAR_DBG("roar_vio_open_tantalos(*): url='%s'", url); 
Note: See TracChangeset for help on using the changeset viewer.