]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Bug fix: correct XSS problems (prevent username with non-alphanumeric characters...
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 14 Nov 2008 14:38:55 +0000 (14:38 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 14 Nov 2008 14:38:55 +0000 (14:38 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@157 b3834d28-1941-0410-a4f8-b48e95affb8f

services/userservice.php
templates/editprofile.tpl.php
templates/profile.tpl.php

index e50faaa8fa9ea1825fcdb8962ad6d8bb9ed0ffa9..9b295daf93121d7420d74b9ddd7d8540f3290464 100644 (file)
@@ -393,8 +393,9 @@ class UserService {
                if (strlen($username) > 24) {
                        // too long usernames are cut by database and may cause bugs when compared 
                        return false;
-               } else {
-                       return true;
+               } elseif (preg_match('/(\W)/', $username) > 0) {
+                       // forbidden non-alphanumeric characters
+                       return false;
                }
                return true;
         }        
index c9eb8a46361d016a45f095216c67fdde5266996e..a38dbd854ea2c182beb5c5cfb53a1ec97833c6df 100644 (file)
@@ -40,7 +40,7 @@ $this->includeTemplate($GLOBALS['top_include']);
 </tr>
 <tr>
     <th align="left"><?php echo T_('Homepage'); ?></th>
-    <td><input type="text" name="pPage" size="75" value="<?php echo filter($row['homepage'], 'xml'); ?>" /></td>
+    <td><input type="text" name="pPage" size="75" value="<?php echo filter($row['homepage']); ?>" /></td>
 </tr>
 <tr>
     <th align="left"><?php echo T_('Description'); ?></th>
index d7ace7ec1bd39115b35431fd95e45c0d4dc9869c..ecfadbb01ece69a74c2601abda0546ce1b4a1779 100644 (file)
@@ -10,13 +10,13 @@ $this->includeTemplate($GLOBALS['top_include']);
 if ($row['name'] != "") {
 ?>
 <dt><?php echo T_('Name'); ?></dt>
-    <dd><?php echo $row['name']; ?></dd>
+    <dd><?php echo filter($row['name']); ?></dd>
 <?php
 }
 if ($row['homepage'] != "") {
 ?>
 <dt><?php echo T_('Homepage'); ?></dt>
-    <dd><a href="<?php echo $row['homepage']; ?>"><?php echo $row['homepage']; ?></a></dd>
+    <dd><a href="<?php echo filter($row['homepage'], 'url'); ?>"><?php echo filter($row['homepage']); ?></a></dd>
 <?php
 }
 ?>