aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 598f6085f..215433704 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -477,11 +477,11 @@ static int
477check_identity_set_default (void *cls, 477check_identity_set_default (void *cls,
478 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm) 478 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm)
479{ 479{
480 uint16_t size = ntohs (sdm->header.size); 480 uint16_t size = ntohs (sdm->header.size) - sizeof (*sdm);
481 uint16_t name_len = ntohs (sdm->name_len); 481 uint16_t name_len = ntohs (sdm->name_len);
482 const char *str = (const char *) &sdm[1]; 482 const char *str = (const char *) &sdm[1];
483 483
484 if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage)) || 484 if ( (size != name_len) ||
485 ( (0 != name_len) && 485 ( (0 != name_len) &&
486 ('\0' != str[name_len - 1]) ) ) 486 ('\0' != str[name_len - 1]) ) )
487 { 487 {