From 2492acd4208bf14bf7747d235cfb9971f2cfbf99 Mon Sep 17 00:00:00 2001 From: xrs Date: Sun, 17 Dec 2017 18:31:36 +0100 Subject: [PATCH] make gnunet-service-peerinfo unlink HELLOs greater than the allowed GNUNET_MAX_MESSAGE_SIZE --- src/peerinfo/gnunet-service-peerinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 731c24bf1..af1eb2d1d 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -987,9 +987,13 @@ discard_hosts_helper (void *cls, int write_pos; unsigned int cnt; char *writebuffer; + uint64_t fsize; + GNUNET_DISK_file_size (fn, &fsize, GNUNET_YES, GNUNET_YES); read_size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer)); - if (read_size < (int) sizeof (struct GNUNET_MessageHeader)) + + if ((read_size < (int) sizeof (struct GNUNET_MessageHeader)) || + (fsize > GNUNET_MAX_MESSAGE_SIZE)) { if (0 != UNLINK (fn)) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | -- 2.25.1