Skip to content

Commit

Permalink
N°4898 - security hardening
Browse files Browse the repository at this point in the history
  • Loading branch information
accognet committed May 30, 2022
1 parent ddb95dc commit fe17907
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/dbobject.class.php
Expand Up @@ -1880,7 +1880,7 @@ public function CheckValue($sAttCode, $value = null)
$oTargetObj = MetaModel::GetObject($sTargetClass, $toCheck, false /*must be found*/, true /*allow all data*/);
if (is_null($oTargetObj))
{
return "Target object not found ($sTargetClass::$toCheck)";
return "Target object not found (".utils::HtmlEntities($sTargetClass).".::".utils::HtmlEntities($toCheck).")";
}
}
if ($oAtt->IsHierarchicalKey())
Expand All @@ -1889,7 +1889,7 @@ public function CheckValue($sAttCode, $value = null)
$aValues = $oAtt->GetAllowedValues(array('this' => $this));
if (!array_key_exists($toCheck, $aValues))
{
return "Value not allowed [$toCheck]";
return "Value not allowed [". utils::HtmlEntities($toCheck)."]";
}
}
}
Expand All @@ -1903,7 +1903,7 @@ public function CheckValue($sAttCode, $value = null)
$oTag->SetValues(explode(' ', $toCheck));
} catch (Exception $e)
{
return "Tag value '$toCheck' is not a valid tag list";
return "Tag value [". utils::HtmlEntities($toCheck)."] is not a valid tag list";
}

return true;
Expand Down Expand Up @@ -1931,7 +1931,7 @@ public function CheckValue($sAttCode, $value = null)
$oTag->SetValues($aValues);
} catch (Exception $e)
{
return "Set value '$toCheck' is not a valid set";
return "Set value[". utils::HtmlEntities($toCheck)."] is not a valid set";
}

return true;
Expand All @@ -1951,7 +1951,7 @@ public function CheckValue($sAttCode, $value = null)
{
if (!array_key_exists($toCheck, $aValues))
{
return "Value not allowed [$toCheck]";
return "Value not allowed [". utils::HtmlEntities($toCheck)."]";
}
}
if (!is_null($iMaxSize = $oAtt->GetMaxSize()))
Expand All @@ -1964,7 +1964,7 @@ public function CheckValue($sAttCode, $value = null)
}
if (!$oAtt->CheckFormat($toCheck))
{
return "Wrong format [$toCheck]";
return "Wrong format [". utils::HtmlEntities($toCheck)."]";
}
}
else
Expand Down

0 comments on commit fe17907

Please sign in to comment.