From: xrs Date: Sun, 17 Dec 2017 17:31:36 +0000 (+0100) Subject: make gnunet-service-peerinfo unlink HELLOs greater than the allowed GNUNET_MAX_MESSAG... X-Git-Tag: gnunet-0.11.0rc0~92 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2492acd4208bf14bf7747d235cfb9971f2cfbf99;p=oweals%2Fgnunet.git make gnunet-service-peerinfo unlink HELLOs greater than the allowed GNUNET_MAX_MESSAGE_SIZE --- 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 |