This patch tweaks the jid_get_* functions, which copy various
fragments of an jabber id into a buffer supplied by the caller.
If these functions don't find the fragments they're looking for, they
now return an empty string in the buffer. Earlier they would leave
the buffer unchanged, leaving it to the calling code to initialize
the buffer.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1321
9efc2488-bf62-4759-914b-
345cdb29e865
if( jid == NULL || buf == NULL || size <= 0 ) { return; }
+ buf[ 0 ] = '\0';
+
/* find the @ and return whatever is in front of it */
int len = strlen( jid );
int i;
memcpy( buf, start, len );
buf[ len ] = '\0';
}
+ else
+ buf[ 0 ] = '\0';
}
void jid_get_domain( const char* jid, char buf[], int size ) {
memcpy( buf, jid + index1, dlen );
buf[dlen] = '\0'; // memcpy doesn't provide the nul
}
+ else
+ buf[ 0 ] = '\0';
}
void set_msg_error( transport_message* msg, const char* type, int err_code ) {