From fb29f9c44acc0fc621194c33951a8135752708d6 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 29 Aug 2007 20:31:52 +0000 Subject: Make IsSID completely strict: Must be [digit][A-Zdigit][A-Zdigit], nothing else. Use it to sanity check SID given on link git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7993 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/utils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/modules/m_spanningtree/utils.cpp') diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 705566d44..0bf8dd994 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -32,9 +32,11 @@ bool SpanningTreeUtilities::IsSID(const std::string &str) { /* Returns true if the string given is exactly 3 characters long, - * starts with a digit, and has no '.' in the other 2 + * starts with a digit, and the other two characters are A-Z or digits */ - return ((str.length() == 3) && isdigit(str[0]) && (str[1] != '.' && str[2] != '.')); + return ((str.length() == 3) && isdigit(str[0]) && + ((str[1] >= 'A' && str[1] <= 'Z') || isdigit(str[1])) && + ((str[2] >= 'A' && str[2] <= 'Z') || isdigit(str[2]))); } /** Yay for fast searches! -- cgit v1.3.1-10-gc9f91