* check the username for length so we don't smash our stack.
authorWilfried Göesgens <willi@citadel.org>
Wed, 3 Oct 2007 13:24:47 +0000 (13:24 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 3 Oct 2007 13:24:47 +0000 (13:24 +0000)
citadel/user_ops.c

index 68ea605695b01c43fa51778611ff64099f525da6..20aa372d234894c89350c93086808e749a05293f 100644 (file)
@@ -62,6 +62,13 @@ static INLINE void makeuserkey(char *key, char *username) {
        int i, len;
 
        len = strlen(username);
+       if (len >= USERNAME_SIZE)
+       {
+               lprintf (CTDL_EMERG, "Username to long: %s", username);
+               cit_backtrace ();
+               len = USERNAME_SIZE - 1; 
+               username[USERNAME_SIZE - 1]='\0';
+       }
        for (i=0; i<=len; ++i) {
                key[i] = tolower(username[i]);
        }