gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r236 - GNUnet/src/applications/sqstore_mysql


From: grothoff
Subject: [GNUnet-SVN] r236 - GNUnet/src/applications/sqstore_mysql
Date: Thu, 10 Feb 2005 18:51:04 -0800 (PST)

Author: grothoff
Date: 2005-02-10 18:51:03 -0800 (Thu, 10 Feb 2005)
New Revision: 236

Modified:
   GNUnet/src/applications/sqstore_mysql/mysql.c
Log:
more bugs found, more fixed, more pending

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2005-02-11 00:55:50 UTC 
(rev 235)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2005-02-11 02:51:03 UTC 
(rev 236)
@@ -186,6 +186,10 @@
   Datastore_Datum * datum;
   int contentSize;
   unsigned long * lens;
+  unsigned int type;
+  unsigned int prio;
+  unsigned int level;
+  unsigned long long exp;
   
   contentSize = atol(sql_row[0]) - sizeof(Datastore_Value);
   if (contentSize < 0)
@@ -193,7 +197,11 @@
 
   lens = mysql_fetch_lengths(res); 
   if ( (lens[5] != sizeof(HashCode160)) ||
-       (lens[6] != contentSize) ) {
+       (lens[6] != contentSize) ||
+       (sscanf(sql_row[1], "%u", &type) != 1) ||
+       (sscanf(sql_row[2], "%u", &prio) != 1) ||
+       (sscanf(sql_row[3], "%u", &level) != 1) ||
+       (sscanf(sql_row[4], "%llu", &exp) != 1) ) {
     LOG(LOG_WARNING,
        "SQL Database corrupt, ignoring result.\n");
     return NULL;
@@ -201,11 +209,10 @@
 
   datum = MALLOC(sizeof(Datastore_Datum) + contentSize);
   datum->value.size = htonl(contentSize + sizeof(Datastore_Value));
-  datum->value.type = htonl(atol(sql_row[1]));
-  datum->value.prio = htonl(atol(sql_row[2]));
-  datum->value.anonymityLevel = htonl(atol(sql_row[3]));
-  datum->value.expirationTime = htonll(atoll(sql_row[4]));
-
+  datum->value.type = htonl(type);
+  datum->value.prio = htonl(prio);
+  datum->value.anonymityLevel = htonl(level);
+  datum->value.expirationTime = htonll(exp);
   memcpy(&datum->key,
         sql_row[5],
         sizeof(HashCode160)); 





reply via email to

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