fixed many memset calls. arguments were not in right order
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
index 9e63703..441b333 100755
--- a/nlsr-sync-0.0/nlsr.c
+++ b/nlsr-sync-0.0/nlsr.c
@@ -204,7 +204,7 @@
char *ip_addr=(char *)malloc(13);
- memset(ip_addr,13,0);
+ memset(ip_addr,0,13);
get_ip_from_hostname_02(nbr_name->name,ip_addr);
printf("IP Address: %s \n",ip_addr);
@@ -583,7 +583,7 @@
if ( nlsr->slice_prefix != NULL)
free(nlsr->slice_prefix);
nlsr->slice_prefix=(char *)malloc(strlen(slice_prefix)+1);
- memset(nlsr->slice_prefix,strlen(slice_prefix)+1,0);
+ memset(nlsr->slice_prefix,0,strlen(slice_prefix)+1);
memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix));
//printf(" Slice Prefix: %s \n",nlsr->slice_prefix);
@@ -751,7 +751,7 @@
{
char *msg;
msg=(char *)malloc(100);
- memset(msg,100,0);
+ memset(msg,0,100);
const char *sep=" \t\n";
char *rem=NULL;
@@ -849,7 +849,7 @@
printf("Hostname of neighbor: %s ",nbr_name->name);
char *ip_addr=(char *)malloc(13);
- memset(ip_addr,13,0);
+ memset(ip_addr,0,13);
get_ip_from_hostname_02(nbr_name->name,ip_addr);
printf("IP Address: %s \n",ip_addr);
int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr_name->name, (const char *)ip_addr, 9695);
@@ -1113,11 +1113,11 @@
nlsr->api_port=API_PORT;
nlsr->topo_prefix=(char *)malloc(strlen("/ndn/routing/nlsr")+1);
- memset(nlsr->topo_prefix,strlen("/ndn/routing/nlsr")+1,0);
+ memset(nlsr->topo_prefix,0,strlen("/ndn/routing/nlsr")+1);
memcpy(nlsr->topo_prefix,"/ndn/routing/nlsr",strlen("/ndn/routing/nlsr"));
nlsr->slice_prefix=(char *)malloc(strlen("/ndn/routing/nlsr/LSA")+1);
- memset(nlsr->slice_prefix,strlen("/ndn/routing/nlsr/LSA")+1,0);
+ memset(nlsr->slice_prefix, 0, strlen("/ndn/routing/nlsr/LSA")+1);
memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
nlsr->is_hyperbolic_calc=0;
diff --git a/nlsr-sync-0.0/nlsr_adl.c b/nlsr-sync-0.0/nlsr_adl.c
index 3b41345..aabac2a 100755
--- a/nlsr-sync-0.0/nlsr_adl.c
+++ b/nlsr-sync-0.0/nlsr_adl.c
@@ -59,7 +59,7 @@
nbr->is_lsdb_send_interest_scheduled=0;
nbr->ip_address=(char *)malloc(13);
- memset(nbr->ip_address,13,0);
+ memset(nbr->ip_address,0,13);
memcpy(nbr->ip_address,ip,strlen(ip));
char *time_stamp=(char *)malloc(20);
diff --git a/nlsr-sync-0.0/nlsr_lsdb.c b/nlsr-sync-0.0/nlsr_lsdb.c
index 8b753bd..f880cc0 100755
--- a/nlsr-sync-0.0/nlsr_lsdb.c
+++ b/nlsr-sync-0.0/nlsr_lsdb.c
@@ -686,11 +686,11 @@
install_adj_lsa(adj_lsa);
char lst[2];
- memset(lst,2,0);
+ memset(lst,0,2);
sprintf(lst,"%d",LS_TYPE_ADJ);
char *repo_con_name=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
- memset(repo_con_name,strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5,0);
+ memset(repo_con_name, 0, strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
make_adj_lsa_prefix_for_repo(repo_con_name, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
printf("Adj LSA Repo Key: %s \n",repo_con_name);
@@ -701,7 +701,7 @@
printf("Adj LSA: %s \n",key);
struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
lsaid->name=(char *)malloc(strlen(key)+1);
- memset(lsaid->name,strlen(key)+1,0);
+ memset(lsaid->name, 0, strlen(key)+1);
memcpy(lsaid->name,key,strlen(key));
lsaid->length=strlen(key)+1;
@@ -2136,7 +2136,7 @@
struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
lsaid->name=(char *)malloc(strlen(key)+1);
- memset(lsaid->name,strlen(key)+1,0);
+ memset(lsaid->name, 0, strlen(key)+1);
memcpy(lsaid->name,key,strlen(key));
lsaid->length=strlen(key)+1;
diff --git a/nlsr-sync-0.0/nlsrc.c b/nlsr-sync-0.0/nlsrc.c
index 8943973..54f1538 100755
--- a/nlsr-sync-0.0/nlsrc.c
+++ b/nlsr-sync-0.0/nlsrc.c
@@ -69,7 +69,7 @@
for(i=5;i<argc;i++)
command_len+=(strlen(argv[i])+1);
char *command=malloc(command_len);
- memset(command,command_len+1,0);
+ memset(command, 0, command_len);
for(i=5;i<argc;i++)
{
memcpy(command+strlen(command),argv[i],strlen(argv[i]));