[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: properly check size of MsgP
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: properly check size of MsgProcRequest |
Date: |
Sun, 07 Jan 2018 18:35:51 +0100 |
This is an automated email from the git hooks/post-receive script.
lurchi pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 638642f8a properly check size of MsgProcRequest
638642f8a is described below
commit 638642f8a3d750d77c501bcd565c05c2f98bbc2d
Author: lurchi <address@hidden>
AuthorDate: Sun Jan 7 18:35:39 2018 +0100
properly check size of MsgProcRequest
---
src/social/gnunet-service-social.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/social/gnunet-service-social.c
b/src/social/gnunet-service-social.c
index 520df20b9..60f1b348d 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -1392,19 +1392,23 @@ msg_proc_parse (const struct MsgProcRequest *mpreq,
const char **method_prefix,
struct GNUNET_HashCode *method_hash)
{
- uint8_t method_size = ntohs (mpreq->header.size) - sizeof (*mpreq);
+ ssize_t method_size = ntohs (mpreq->header.size) - sizeof (*mpreq);
uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &mpreq[1],
method_size, 1,
method_prefix);
+ if (method_size < 0)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "MsgProcRequest has invalid size\n");
+ return GNUNET_SYSERR;
+ }
if (0 == offset || offset != method_size || *method_prefix == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "offset = %u, method_size = %u, method_name = %s\n",
- offset, method_size, *method_prefix);
+ "MsgProcRequest contains invalid method\n");
return GNUNET_SYSERR;
}
-
- GNUNET_CRYPTO_hash (*method_prefix, method_size, method_hash);
+ GNUNET_CRYPTO_hash (*method_prefix, (size_t) method_size, method_hash);
*flags = ntohl (mpreq->flags);
return GNUNET_OK;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: properly check size of MsgProcRequest,
gnunet <=