gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4805 - in GNUnet/src/applications: fs/ecrs identity


From: gnunet
Subject: [GNUnet-SVN] r4805 - in GNUnet/src/applications: fs/ecrs identity
Date: Sun, 27 May 2007 14:44:21 -0600 (MDT)

Author: grothoff
Date: 2007-05-27 14:44:21 -0600 (Sun, 27 May 2007)
New Revision: 4805

Modified:
   GNUnet/src/applications/fs/ecrs/uri.c
   GNUnet/src/applications/identity/clientapi.c
Log:
fixing some recently introduced crashes

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2007-05-27 20:29:25 UTC (rev 
4804)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2007-05-27 20:44:21 UTC (rev 
4805)
@@ -631,15 +631,21 @@
   int i;
 
   GE_ASSERT(NULL, uri != NULL);
-  if (uri->type == ksk) {
+  switch(uri->type) {
+  case ksk:
     for (i=0;i<uri->data.ksk.keywordCount;i++)
       FREE(uri->data.ksk.keywords[i]);
     GROW(uri->data.ksk.keywords,
         uri->data.ksk.keywordCount,
         0);
+    break;
+  case loc:
+    FREENONNULL(uri->data.loc.address);
+    break;
+  default:
+    /* do nothing */
+    break;
   }
-  if (uri->type == loc)
-    FREENONNULL(uri->data.loc.address);
   FREE(uri);
 }
 
@@ -798,10 +804,12 @@
     }
     break;
   case loc:
-    ret->data.loc.address = MALLOC(ret->data.loc.sas);
-    memcpy(ret->data.loc.address,
-          uri->data.loc.address,
-          ret->data.loc.sas);
+    if (ret->data.loc.sas > 0) {
+      ret->data.loc.address = MALLOC(ret->data.loc.sas);
+      memcpy(ret->data.loc.address,
+            uri->data.loc.address,
+            ret->data.loc.sas);
+    }
     break;
   default:
     break;

Modified: GNUnet/src/applications/identity/clientapi.c
===================================================================
--- GNUnet/src/applications/identity/clientapi.c        2007-05-27 20:29:25 UTC 
(rev 4804)
+++ GNUnet/src/applications/identity/clientapi.c        2007-05-27 20:44:21 UTC 
(rev 4805)
@@ -53,10 +53,10 @@
   hash(key,
        sizeof(PublicKey),
        &msg->m.senderIdentity.hashPubKey);
-  msg->m.expirationTime = expirationTime;
-  msg->m.MTU = mtu;
-  msg->m.senderAddressSize = sas;
-  msg->m.protocol = proto;
+  msg->m.expirationTime = htonl(expirationTime);
+  msg->m.MTU = htonl(mtu);
+  msg->m.senderAddressSize = htons(sas);
+  msg->m.protocol = htons(proto);
   memcpy(&msg[1],
         address,
         sas);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]