commit cab09764af1b6ac7a310e48200e70435e4c3fbd6
parent 3b6b167a96b8ebf398a316b1b0ccbe1041bf159c
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 13 Aug 2026 18:59:30 +0200
fix NPE if we only got <4 bytes
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c
@@ -281,7 +281,8 @@ TES_read_work (void *cls,
}
off += recv_size;
more:
- if (off < sizeof (struct GNUNET_MessageHeader))
+ msize = sizeof (*hdr); /* at least */
+ if (off < msize)
continue;
hdr = (const struct GNUNET_MessageHeader *) buf;
msize = ntohs (hdr->size);
@@ -291,7 +292,7 @@ more:
(unsigned int) ntohs (hdr->type),
(unsigned int) msize);
#endif
- if (msize < sizeof (struct GNUNET_MessageHeader))
+ if (msize < sizeof (*hdr))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;