diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-26 12:49:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-26 12:49:15 +0000 |
commit | 00360860690de6b43b64ca9c3d52cbe3fe354bbe (patch) | |
tree | 72ed540a4bb205e7ed1f255cf03158bd72d038bd /src | |
parent | 939d23ccbb6ec5753d141f325339529b9b2e4f80 (diff) | |
download | gnunet-00360860690de6b43b64ca9c3d52cbe3fe354bbe.tar.gz gnunet-00360860690de6b43b64ca9c3d52cbe3fe354bbe.zip |
fix missing 0-termination
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/plugin_namestore_flat.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index b522fc031..869aa3d9f 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c | |||
@@ -180,11 +180,11 @@ database_setup (struct Plugin *plugin) | |||
180 | afsdir); | 180 | afsdir); |
181 | return GNUNET_SYSERR; | 181 | return GNUNET_SYSERR; |
182 | } | 182 | } |
183 | 183 | if (GNUNET_SYSERR == | |
184 | if (GNUNET_SYSERR == GNUNET_DISK_file_size (afsdir, | 184 | GNUNET_DISK_file_size (afsdir, |
185 | &size, | 185 | &size, |
186 | GNUNET_YES, | 186 | GNUNET_YES, |
187 | GNUNET_YES)) | 187 | GNUNET_YES)) |
188 | { | 188 | { |
189 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 189 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
190 | _("Unable to get filesize: %s.\n"), | 190 | _("Unable to get filesize: %s.\n"), |
@@ -192,20 +192,21 @@ database_setup (struct Plugin *plugin) | |||
192 | return GNUNET_SYSERR; | 192 | return GNUNET_SYSERR; |
193 | } | 193 | } |
194 | 194 | ||
195 | buffer = GNUNET_malloc (size); | 195 | buffer = GNUNET_malloc (size) + 1; |
196 | 196 | if (GNUNET_SYSERR == | |
197 | if (GNUNET_SYSERR == GNUNET_DISK_file_read (fh, | 197 | GNUNET_DISK_file_read (fh, |
198 | buffer, | 198 | buffer, |
199 | size)) | 199 | size)) |
200 | { | 200 | { |
201 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 201 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
202 | _("Unable to read file: %s.\n"), | 202 | _("Unable to read file: %s.\n"), |
203 | afsdir); | 203 | afsdir); |
204 | return GNUNET_SYSERR; | 204 | return GNUNET_SYSERR; |
205 | } | 205 | } |
206 | |||
207 | GNUNET_DISK_file_close (fh); | 206 | GNUNET_DISK_file_close (fh); |
208 | if (0 < size) { | 207 | |
208 | if (0 < size) | ||
209 | { | ||
209 | line = strtok (buffer, "\n"); | 210 | line = strtok (buffer, "\n"); |
210 | while (line != NULL) { | 211 | while (line != NULL) { |
211 | zone_private_key = strtok (line, ","); | 212 | zone_private_key = strtok (line, ","); |
@@ -347,6 +348,7 @@ store_and_free_entries (void *cls, | |||
347 | return GNUNET_YES; | 348 | return GNUNET_YES; |
348 | } | 349 | } |
349 | 350 | ||
351 | |||
350 | /** | 352 | /** |
351 | * Shutdown database connection and associate data | 353 | * Shutdown database connection and associate data |
352 | * structures. | 354 | * structures. |