aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-09-22 11:35:38 +0000
committerGabor X Toth <*@tg-x.net>2016-09-22 11:35:38 +0000
commit76a029cc8d1dbf3d470079e98be1f3b7c4783ef0 (patch)
tree0448061d5cbfcab71265ec71b32ed83b8e591e9a /src/psycstore
parent2f26cb57675966de7f04606fa83b0f0fc1dae46b (diff)
downloadgnunet-76a029cc8d1dbf3d470079e98be1f3b7c4783ef0.tar.gz
gnunet-76a029cc8d1dbf3d470079e98be1f3b7c4783ef0.zip
psyc,psycstore,social fixes
Diffstat (limited to 'src/psycstore')
-rw-r--r--src/psycstore/psycstore_api.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index 7bbf2e3d8..480d594fc 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -122,7 +122,7 @@ check_result_code (void *cls, const struct OperationResult *opres)
122{ 122{
123 uint16_t size = ntohs (opres->header.size); 123 uint16_t size = ntohs (opres->header.size);
124 const char *str = (const char *) &opres[1]; 124 const char *str = (const char *) &opres[1];
125 if ( (sizeof (struct OperationResult) < size) && 125 if ( (sizeof (*opres) < size) &&
126 ('\0' != str[size - sizeof (*opres) - 1]) ) 126 ('\0' != str[size - sizeof (*opres) - 1]) )
127 { 127 {
128 GNUNET_break (0); 128 GNUNET_break (0);
@@ -244,9 +244,12 @@ static int
244check_result_state (void *cls, const struct StateResult *sres) 244check_result_state (void *cls, const struct StateResult *sres)
245{ 245{
246 const char *name = (const char *) &sres[1]; 246 const char *name = (const char *) &sres[1];
247 uint16_t size = ntohs (sres->header.size);
247 uint16_t name_size = ntohs (sres->name_size); 248 uint16_t name_size = ntohs (sres->name_size);
248 249
249 if (name_size <= 2 || '\0' != name[name_size - 1]) 250 if (name_size <= 2
251 || size - sizeof (*sres) < name_size
252 || '\0' != name[name_size - 1])
250 { 253 {
251 LOG (GNUNET_ERROR_TYPE_ERROR, 254 LOG (GNUNET_ERROR_TYPE_ERROR,
252 "check_result_state: Received state result message with invalid name.\n"); 255 "check_result_state: Received state result message with invalid name.\n");