write_data_to_repo
diff --git a/nlsr_sync.c b/nlsr_sync.c
index c1263b4..65caed2 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -261,8 +261,9 @@
 		length = resultbuf->length;
 		if (content_only){
 			ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
-			*content_data = (unsigned char *) calloc(length, sizeof(char *));
+			*content_data = (unsigned char *) calloc(length+1, sizeof(char *));
 			memcpy (*content_data, ptr, length);
+			*content_data[strlen((char *)*content_data)]='\0';
 		}
 	}
 	ccn_charbuf_destroy(&resultbuf);