From 61ad90c5d4ec73bb4dde311d26b09250d66bbc55 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Dec 2013 09:56:57 +0000 Subject: -handle errors in address part --- src/peerinfo/gnunet-service-peerinfo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/peerinfo') diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index b7fa1c722..25a7ae3b1 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -386,6 +386,21 @@ read_host_file (const char *fn, now = GNUNET_TIME_absolute_get (); hello_clean = GNUNET_HELLO_iterate_addresses (hello, GNUNET_YES, &discard_expired, &now); + if (NULL == hello_clean) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to parse HELLO in file `%s': %s %u \n"), + fn, + "HELLO is invalid and has size of ", + size_hello); + if ((GNUNET_YES == unlink_garbage) && + (0 != UNLINK (fn)) && + (ENOENT != errno) ) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, + "unlink", + fn); + return; + } left = 0; (void) GNUNET_HELLO_iterate_addresses (hello_clean, GNUNET_NO, &count_addresses, &left); -- cgit v1.2.3