Changeset 11624


Ignore:
Timestamp:
Jan 3, 2011, 3:01:12 AM (11 years ago)
Author:
charles
Message:

(trunk libT) fix crash reported by KyleK

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r11610 r11624  
    243243
    244244    if( is_default_value != NULL )
    245         *is_default_value = !strcmp( default_value, tr_ntop_non_ts( &bindinfo->addr ) );
     245        *is_default_value = !tr_strcmp0( default_value, tr_ntop_non_ts( &bindinfo->addr ) );
    246246
    247247    return bindinfo ? &bindinfo->addr : NULL;
  • trunk/libtransmission/utils.c

    r11614 r11624  
    775775}
    776776
     777int
     778tr_strcmp0( const char * str1, const char * str2 )
     779{
     780    if( str1 && str2 ) return strcmp( str1, str2 );
     781    if( str1 ) return 1;
     782    if( str2 ) return -1;
     783    return 0;
     784}
     785
    777786/****
    778787*****
  • trunk/libtransmission/utils.h

    r11614 r11624  
    348348 */
    349349char* tr_strdup( const void * in );
     350
     351/**
     352 * @brief like strcmp() but gracefully handles NULL strings
     353 */
     354int tr_strcmp0( const char * str1, const char * str2 );
     355
    350356
    351357
Note: See TracChangeset for help on using the changeset viewer.