aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
Diffstat (limited to 'src/social')
-rw-r--r--src/social/social_api.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/social/social_api.c b/src/social/social_api.c
index e34774aae..f05e437ca 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -657,10 +657,17 @@ check_place_state_result (void *cls,
657 const struct GNUNET_OperationResultMessage *res) 657 const struct GNUNET_OperationResultMessage *res)
658{ 658{
659 const struct GNUNET_MessageHeader *mod = GNUNET_MQ_extract_nested_mh (res); 659 const struct GNUNET_MessageHeader *mod = GNUNET_MQ_extract_nested_mh (res);
660 uint16_t mod_size = ntohs (mod->size); 660 if (NULL == mod)
661 uint16_t size = ntohs (res->header.size); 661 {
662 GNUNET_break_op (0);
663 LOG (GNUNET_ERROR_TYPE_WARNING,
664 "Invalid modifier in state result\n");
665 return GNUNET_SYSERR;
666 }
662 667
663 if (NULL == mod || size - sizeof (*res) != mod_size) 668 uint16_t size = ntohs (res->header.size);
669 uint16_t mod_size = ntohs (mod->size);
670 if (size - sizeof (*res) != mod_size)
664 { 671 {
665 GNUNET_break_op (0); 672 GNUNET_break_op (0);
666 LOG (GNUNET_ERROR_TYPE_WARNING, 673 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -700,7 +707,9 @@ handle_place_state_result (void *cls,
700 707
701 const char *name = (const char *) &pmod[1]; 708 const char *name = (const char *) &pmod[1];
702 uint16_t name_size = ntohs (pmod->name_size); 709 uint16_t name_size = ntohs (pmod->name_size);
703 if ('\0' != name[name_size - 1]) 710 if (0 == name_size
711 || mod_size - sizeof (*pmod) < name_size
712 || '\0' != name[name_size - 1])
704 { 713 {
705 GNUNET_break_op (0); 714 GNUNET_break_op (0);
706 LOG (GNUNET_ERROR_TYPE_WARNING, 715 LOG (GNUNET_ERROR_TYPE_WARNING,