Reject presence updates with too long keys, instead of truncating them

and causing soft assertion failures. Values are still
silently truncated though.
This commit is contained in:
Jilles Tjoelker 2009-06-03 23:49:50 +02:00
parent 9d393c9052
commit 338dd42d64
1 changed files with 9 additions and 0 deletions

View File

@ -79,6 +79,12 @@ m_presence(struct Client *client_p, struct Client *source_p, int parc, const cha
return 0; return 0;
} }
if (strlen(parv[1]) >= METADATAKEYLEN)
{
sendto_one_notice(source_p, ":Metadata key too long");
return 0;
}
if ((val = get_metadata(source_p, parv[1])) != NULL) if ((val = get_metadata(source_p, parv[1])) != NULL)
{ {
if (!strcmp(parv[2], val)) if (!strcmp(parv[2], val))
@ -114,6 +120,9 @@ me_presence(struct Client *client_p, struct Client *source_p, int parc, const ch
return 0; return 0;
} }
if (strlen(parv[1]) >= METADATAKEYLEN)
return 0;
if ((val = get_metadata(source_p, parv[1])) != NULL) if ((val = get_metadata(source_p, parv[1])) != NULL)
{ {
if (!strcmp(parv[2], val)) if (!strcmp(parv[2], val))