Use snprintf() instead of multiple strcat() calls for building the searchdn.