Potential SQL injection in Local_group::setNickname()

This change escapes a parameter in Local_group::setNickname(). Review
of the code paths that call this function sanitize the parameter
higher up the stack, but it's escaped here to prevent mistakes later.

Note that nickname parameters are normally alphanum strings, so
there's not much danger in double-escaping them.
This commit is contained in:
Joshua Wise 2013-07-16 10:09:16 -07:00 committed by Evan Prodromou
parent 540b90dbd9
commit 783e400d94
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ class Local_group extends Managed_DataObject
function setNickname($nickname)
{
$this->decache();
$qry = 'UPDATE local_group set nickname = "'.$nickname.'" where group_id = ' . $this->group_id;
$qry = 'UPDATE local_group set nickname = "'.$this->escape($nickname).'" where group_id = ' . $this->group_id;
$result = $this->query($qry);