0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

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 7919c03041
commit 50325a6667

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))