]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Reject presence updates with too long keys, instead of truncating them
authorJilles Tjoelker <redacted>
Wed, 3 Jun 2009 21:49:50 +0000 (23:49 +0200)
committerJilles Tjoelker <redacted>
Wed, 3 Jun 2009 21:49:50 +0000 (23:49 +0200)
and causing soft assertion failures. Values are still
silently truncated though.

modules/m_presence.c

index 70eca96cf2226f884b3b09214e01b571b05de1ed..a9a16b1afe6e08c304e239531e0835e956f82c4e 100644 (file)
@@ -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))