fix parsing of relay ids by replacing separating \n with \0.

This commit is contained in:
Andy2 2010-11-23 17:46:16 -08:00
parent 111c59dd30
commit 1720fbbd50

View file

@ -773,25 +773,27 @@ handle_proxy_tproc( void* closure )
int ii;
for ( ii = 0; ii < nameCount; ++ii ) {
unsigned short seed;
if ( getNetShort( &bufp, end, &seed ) ) {
const unsigned char* crptr =
if ( !getNetShort( &bufp, end, &seed ) ) {
break;
}
unsigned char* crptr =
(unsigned char*)strchr( (char*)bufp, '\n' );
if ( NULL != crptr && crptr < end ) {
if ( NULL == crptr || crptr >= end ) {
break;
}
*crptr = '\0';
HostID hid;
char connName[MAX_CONNNAME_LEN+1];
if ( parseRelayID( (char*)bufp, connName,
if ( !parseRelayID( (const char*)bufp, connName,
&hid ) ) {
break;
}
SafeCref scr( connName );
scr.DeviceGone( hid, seed );
}
/* skip "\n" */
bufp = (unsigned char*)crptr + 1;
} else {
break;
}
} else {
break;
}
bufp = crptr + 1;
}
}
}