Disallow usernames with more than 255 characters
authorTim Düsterhus <timwolla@googlemail.com>
Sun, 17 Feb 2013 14:41:35 +0000 (15:41 +0100)
committerTim Düsterhus <timwolla@googlemail.com>
Sun, 17 Feb 2013 14:41:35 +0000 (15:41 +0100)
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'username' at row 1

wcfsetup/install/files/lib/util/UserUtil.class.php

index c3554e2b478a545fca8a9c9a66f426f531bb1c57..116ed6ee0fc1893f31aea4003d8f02f5948a3a10 100644 (file)
@@ -20,8 +20,8 @@ final class UserUtil {
         * @return      boolean
         */
        public static function isValidUsername($name) {
-               // minimum length are 3 characters
-               if (StringUtil::length($name) < 3) {
+               // minimum length is 3 characters, maximum length is 255 characters
+               if (StringUtil::length($name) < 3 || StringUtil::length($name) > 255) {
                        return false;
                }