From 338dd42d64561d020d61bd10277c620c4da33678 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 3 Jun 2009 23:49:50 +0200 Subject: [PATCH] Reject presence updates with too long keys, instead of truncating them and causing soft assertion failures. Values are still silently truncated though. --- modules/m_presence.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/m_presence.c b/modules/m_presence.c index 70eca96..a9a16b1 100644 --- a/modules/m_presence.c +++ b/modules/m_presence.c @@ -79,6 +79,12 @@ m_presence(struct Client *client_p, struct Client *source_p, int parc, const cha 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 (!strcmp(parv[2], val)) @@ -114,6 +120,9 @@ me_presence(struct Client *client_p, struct Client *source_p, int parc, const ch return 0; } + if (strlen(parv[1]) >= METADATAKEYLEN) + return 0; + if ((val = get_metadata(source_p, parv[1])) != NULL) { if (!strcmp(parv[2], val))