[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37796 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37796 - gnunet/src/namestore |
Date: |
Fri, 26 Aug 2016 14:49:15 +0200 |
Author: grothoff
Date: 2016-08-26 14:49:15 +0200 (Fri, 26 Aug 2016)
New Revision: 37796
Modified:
gnunet/src/namestore/plugin_namestore_flat.c
Log:
fix missing 0-termination
Modified: gnunet/src/namestore/plugin_namestore_flat.c
===================================================================
--- gnunet/src/namestore/plugin_namestore_flat.c 2016-08-26 12:48:07 UTC
(rev 37795)
+++ gnunet/src/namestore/plugin_namestore_flat.c 2016-08-26 12:49:15 UTC
(rev 37796)
@@ -180,11 +180,11 @@
afsdir);
return GNUNET_SYSERR;
}
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_size (afsdir,
- &size,
- GNUNET_YES,
- GNUNET_YES))
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_file_size (afsdir,
+ &size,
+ GNUNET_YES,
+ GNUNET_YES))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to get filesize: %s.\n"),
@@ -192,11 +192,11 @@
return GNUNET_SYSERR;
}
- buffer = GNUNET_malloc (size);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_read (fh,
- buffer,
- size))
+ buffer = GNUNET_malloc (size) + 1;
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_file_read (fh,
+ buffer,
+ size))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to read file: %s.\n"),
@@ -203,9 +203,10 @@
afsdir);
return GNUNET_SYSERR;
}
+ GNUNET_DISK_file_close (fh);
- GNUNET_DISK_file_close (fh);
- if (0 < size) {
+ if (0 < size)
+ {
line = strtok (buffer, "\n");
while (line != NULL) {
zone_private_key = strtok (line, ",");
@@ -347,6 +348,7 @@
return GNUNET_YES;
}
+
/**
* Shutdown database connection and associate data
* structures.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37796 - gnunet/src/namestore,
gnunet <=