Changeset 5687:2462b285607d in roaraudio


Ignore:
Timestamp:
10/05/12 13:43:51 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Fixed segfault caused by strstr() in low level socket interface.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5686 r5687  
    88        * Install parts from build system (Closes: #325) 
    99        * Re-ported to win32 (Closes: #330, #331) 
     10        * Fixed segfault caused by strstr() in low level socket interface. 
    1011 
    1112v. 1.0beta6 - Fri Sep 21 2012 18:03 CEST 
  • libroar/socket.c

    r5619 r5687  
    601601 if ( type == ROAR_SOCKET_TYPE_DECNET ) { 
    602602#ifdef ROAR_HAVE_LIBDNET 
    603    ROAR_DBG("roar_socket_open(*): hostname for DECnet: host(%p)=%s", host, host); 
     603   ROAR_DBG("roar_socket_open(*): nodename for DECnet: host(%p)=%s", host, host); 
     604   dnet_node_buf = roar_mm_strdup(host); 
     605   // roar_error is still set. 
     606   if ( dnet_node_buf == NULL ) 
     607    return -1; 
     608 
     609   host = dnet_node_buf; 
     610 
    604611   del = strstr(host, "::"); 
    605    ROAR_DBG("roar_socket_open(*): hostname for DECnet: del(%p)=%s", del, del); 
     612   ROAR_DBG("roar_socket_open(*): nodename for DECnet: del(%p)=%s", del, del); 
    606613 
    607614   if ( del == NULL ) { 
    608     ROAR_WARN("roar_socket_open(*): invalid hostname for DECnet: %s", host); 
     615    ROAR_WARN("roar_socket_open(*): invalid nodename for DECnet: %s", host); 
     616    roar_mm_free(dnet_node_buf); 
    609617    roar_err_set(ROAR_ERROR_INVAL); 
    610618    return -1; 
     
    628636  if ( mode == MODE_LISTEN ) { 
    629637   fh = roar_socket_listen_decnet(obj, port); 
    630    *del = ':'; 
     638   roar_mm_free(dnet_node_buf); 
    631639   return fh; 
    632640  } else { 
    633641   // There is nothing wrong in this case to use dnet_conn() so we do. 
    634    dnet_node_buf = roar_mm_strdup(host); 
    635    if ( dnet_node_buf == NULL ) { 
    636     *del = ':'; 
    637     return -1; 
    638    } 
    639642   ROAR_DBG("roar_socket_open(*): CALL dnet_conn('%s', '%s', SOCK_STREAM, 0 ,0 ,0 , 0)", dnet_node_buf, obj); 
    640643   fh = dnet_conn(dnet_node_buf, obj, SOCK_STREAM, 0, 0, 0, 0); 
    641644   ROAR_DBG("roar_socket_open(*): RET %i", fh); 
    642645   roar_mm_free(dnet_node_buf); 
    643    *del = ':'; 
    644646   return fh; 
    645647  } 
Note: See TracChangeset for help on using the changeset viewer.