mirror of https://github.com/BOINC/boinc.git
web: fix SQL injection vulnerability in remote job submission
Also cast ID to int in lookup_id. This isn't a vulnerability AFAIK, but doesn't hurt to be safe
This commit is contained in:
parent
cad6475aaa
commit
6b9205b3a1
|
@ -139,6 +139,7 @@ class BoltCourse {
|
|||
}
|
||||
static function lookup_name($name) {
|
||||
$db = BoltDb::get();
|
||||
$name = BoincDb::escape_string($name);
|
||||
return $db->lookup('bolt_course', 'BoltCourse', "short_name='$name'");
|
||||
}
|
||||
static function enum() {
|
||||
|
|
|
@ -107,6 +107,7 @@ class DbConn {
|
|||
}
|
||||
|
||||
function lookup_id($id, $table, $classname) {
|
||||
$id = (int)$id;
|
||||
return $this->lookup($table, $classname, "id=$id");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class BoincBatch {
|
|||
}
|
||||
static function lookup_name($name) {
|
||||
$db = BoincDb::get();
|
||||
$name = BoincDb::escape_string($name);
|
||||
return $db->lookup('batch', 'BoincBatch', "name='$name'");
|
||||
}
|
||||
static function enum($clause) {
|
||||
|
|
Loading…
Reference in New Issue