diff --git a/includes/html/forms/customoid.inc.php b/includes/html/forms/customoid.inc.php
index fa45fbd216..219c7861ca 100644
--- a/includes/html/forms/customoid.inc.php
+++ b/includes/html/forms/customoid.inc.php
@@ -72,8 +72,8 @@ if (!empty(mres($_POST['user_func']))) {
}
if ($action == "test") {
- $query = "SELECT * FROM `devices` WHERE `device_id` = $device_id LIMIT 1";
- $device = dbFetchRow($query);
+ $query = "SELECT * FROM `devices` WHERE `device_id` = ? LIMIT 1";
+ $device = dbFetchRow($query, [$device_id]);
$rawdata = snmp_get($device, $oid, '-Oqv');