Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Jan 20, 2025
1 parent 324f489 commit 2451986
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sql_injection/detect_sql_injection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ fn has_multiple_statements(query: &str, dialect: i32) -> bool {
return false;
}

// Find the first valid statement and see if there's anything left
for (i, c) in query.char_indices() {
if c == ';' {
let statement = &query[..i + 1];
let tokens_stripped = tokenize_with_fallback(statement, dialect);
if tokens_stripped.len() > 0 {
if let Some(Token::SemiColon) = tokens_stripped.last() {
let tokens = tokenize_with_fallback(statement, dialect);
if tokens.len() > 0 {
if let Some(Token::SemiColon) = tokens.last() {
let remaining = &query[i + 1..];

return remaining.trim().len() > 0;
Expand Down

0 comments on commit 2451986

Please sign in to comment.