Loading...
Loading...
Compare original and translation side by side
undefinedundefinedundefinedundefinedundefinedundefined
```java
// Java危险函数
Runtime.exec()
ProcessBuilder()
Class.forName()// PHP危险函数
eval()
exec()
system()
passthru()
```java
// Java危险函数
Runtime.exec()
ProcessBuilder()
Class.forName()// PHP危险函数
eval()
exec()
system()
passthru()String query = "SELECT * FROM users WHERE id = " + userId;
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(query);String query = "SELECT * FROM users WHERE id = ?";
PreparedStatement stmt = connection.prepareStatement(query);
stmt.setInt(1, userId);
ResultSet rs = stmt.executeQuery();String query = "SELECT * FROM users WHERE id = " + userId;
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(query);String query = "SELECT * FROM users WHERE id = ?";
PreparedStatement stmt = connection.prepareStatement(query);
stmt.setInt(1, userId);
ResultSet rs = stmt.executeQuery();document.innerHTML = userInput;
element.innerHTML = "<div>" + userInput + "</div>";element.textContent = userInput;
element.setAttribute("data-value", userInput);
// 或使用编码库
element.innerHTML = escapeHtml(userInput);document.innerHTML = userInput;
element.innerHTML = "<div>" + userInput + "</div>";element.textContent = userInput;
element.setAttribute("data-value", userInput);
// 或使用编码库
element.innerHTML = escapeHtml(userInput);import os
os.system("ping " + user_input)import subprocess
subprocess.run(["ping", "-c", "1", validated_input])import os
os.system("ping " + user_input)import subprocess
subprocess.run(["ping", "-c", "1", validated_input])String filePath = "/uploads/" + fileName;
File file = new File(filePath);String basePath = "/uploads/";
String fileName = Paths.get(fileName).getFileName().toString();
String filePath = basePath + fileName;
File file = new File(filePath);
if (!file.getCanonicalPath().startsWith(basePath)) {
throw new SecurityException("Invalid path");
}String filePath = "/uploads/" + fileName;
File file = new File(filePath);String basePath = "/uploads/";
String fileName = Paths.get(fileName).getFileName().toString();
String filePath = basePath + fileName;
File file = new File(filePath);
if (!file.getCanonicalPath().startsWith(basePath)) {
throw new SecurityException("Invalid path");
}String apiKey = "1234567890abcdef";
String password = "admin123";String apiKey = System.getenv("API_KEY");
String password = keyStore.getPassword("db_password");String apiKey = "1234567890abcdef";
String password = "admin123";String apiKey = System.getenv("API_KEY");
String password = keyStore.getPassword("db_password");undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined