Validity Checking in nlsr-sync
diff --git a/nlsr.c b/nlsr.c
index 20c7d45..1d16b4c 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -193,17 +193,22 @@
 	{
 		struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
 		get_host_name_from_command_string(nbr_name,nbr->name,0);
-		printf("Hostname of neighbor: %s ",nbr_name->name);
+		if ( nlsr->debugging)
+			printf("Hostname of neighbor: %s ",nbr_name->name);
 		get_ip_from_hostname_02(nbr_name->name,ip_addr);
-		printf("IP Address: %s \n",ip_addr);
+		if ( nlsr->debugging)
+			printf("IP Address: %s \n",ip_addr);
 		free(nbr_name->name);
 		free(nbr_name);
 	}
 	else
 	{
 		memcpy(ip_addr,nbr_ip_addr,strlen(nbr_ip_addr));
-		printf("Name of neighbor: %s ",nbr->name);
-		printf("IP Address: %s \n",ip_addr);
+		if (nlsr->debugging)
+		{
+			printf("Name of neighbor: %s ",nbr->name);
+			printf("IP Address: %s \n",ip_addr);
+		}
 	}
 	add_nbr_to_adl(nbr,0,ip_addr);
 	
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 042466a..6e96d7b 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -58,8 +58,8 @@
 		nbr->metric=LINK_METRIC;
 		nbr->is_lsdb_send_interest_scheduled=0;
 		
-		nbr->ip_address=(char *)malloc(13);
-		memset(nbr->ip_address,0,13);
+		nbr->ip_address=(char *)malloc(strlen(ip)+1);
+		memset(nbr->ip_address,0,strlen(ip)+1);
 		memcpy(nbr->ip_address,ip,strlen(ip));
 
 		char *time_stamp=(char *)malloc(20);
diff --git a/nlsr_sync.c b/nlsr_sync.c
index 7b228c5..2804ee8 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -82,14 +82,22 @@
  	struct ccn_indexbuf cid={0};
 
     	struct ccn_indexbuf *components=&cid;
-    	ccn_name_split (name, components);
+    	res=ccn_name_split (name, components);
+	if ( res < 0 )
+		return 0;
     	//ccn_name_chop(name,components,-3);
 	//process_content_from_sync(name,components);
 
 	struct ccn_charbuf *content_name = ccn_charbuf_create();
 	ccn_name_init(content_name);
+	if (components->n < 2)
+		return 0;
 	res = ccn_name_append_components(content_name, name->buf, components->buf[0], components->buf[components->n - 1]);
 
+	if ( res < 0)
+		return 0;
+
+
 	// debugging purpose
 	struct ccn_charbuf *temp=ccn_charbuf_create();
 	ccn_uri_append(temp, content_name->buf, content_name->length, 0);
@@ -100,6 +108,9 @@
 	struct ccn_indexbuf cid1={0};
     	struct ccn_indexbuf *components1=&cid1;
     	res=ccn_name_split (content_name, components1);
+	if ( res < 0)
+		return 0;		
+
 	if ( nlsr->debugging )
 		{
 			printf("Number of components in name = %d \n",res);