FIX #11671 CVE-2019-15062

This commit is contained in:
Laurent Destailleur 2019-08-16 16:41:53 +02:00
parent 12e6dabc43
commit 9692ea5faf
3 changed files with 7 additions and 9 deletions

View File

@ -125,8 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($db); $link = new Link($db);
$link->id = $linkid; $link->fetch($linkid);
$link->fetch();
$res = $link->delete($user); $res = $link->delete($user);
$langs->load('link'); $langs->load('link');
@ -160,8 +159,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$langs->load('link'); $langs->load('link');
$link = new Link($db); $link = new Link($db);
$link->id = GETPOST('linkid', 'int'); $f = $link->fetch(GETPOST('linkid', 'int'));
$f = $link->fetch();
if ($f) if ($f)
{ {
$link->url = GETPOST('link', 'alpha'); $link->url = GETPOST('link', 'alpha');
@ -169,7 +167,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('
{ {
$link->url = 'http://' . $link->url; $link->url = 'http://' . $link->url;
} }
$link->label = GETPOST('label', 'alpha'); $link->label = GETPOST('label', 'alphanohtml');
$res = $link->update($user); $res = $link->update($user);
if (!$res) if (!$res)
{ {

View File

@ -1839,7 +1839,7 @@ class FormFile
print $langs->trans('Link') . ': <input type="text" name="link" value="' . $link->url . '">'; print $langs->trans('Link') . ': <input type="text" name="link" value="' . $link->url . '">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">'; print $langs->trans('Label') . ': <input type="text" name="label" value="' . dol_escape_htmltag($link->label) . '">';
print '</td>'; print '</td>';
print '<td class="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>'; print '<td class="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td class="right"></td>'; print '<td class="right"></td>';
@ -1853,7 +1853,7 @@ class FormFile
print '<td>'; print '<td>';
print img_picto('', 'object_globe').' '; print img_picto('', 'object_globe').' ';
print '<a data-ajax="false" href="' . $link->url . '" target="_blank">'; print '<a data-ajax="false" href="' . $link->url . '" target="_blank">';
print $link->label; print dol_escape_htmltag($link->label);
print '</a>'; print '</a>';
print '</td>'."\n"; print '</td>'."\n";
print '<td class="right"></td>'; print '<td class="right"></td>';

View File

@ -329,12 +329,12 @@ if (empty($reshook)) {
{ {
$error = 0; $error = 0;
if (!$_POST["lastname"]) { if (! GETPOST("lastname", 'alpha')) {
setEventMessages($langs->trans("NameNotDefined"), null, 'errors'); setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action = "edit"; // Go back to create page $action = "edit"; // Go back to create page
$error ++; $error ++;
} }
if (!$_POST["login"]) { if (! GETPOST("login", 'alpha')) {
setEventMessages($langs->trans("LoginNotDefined"), null, 'errors'); setEventMessages($langs->trans("LoginNotDefined"), null, 'errors');
$action = "edit"; // Go back to create page $action = "edit"; // Go back to create page
$error ++; $error ++;