Skip to content
This repository was archived by the owner on Jan 30, 2018. It is now read-only.
This repository was archived by the owner on Jan 30, 2018. It is now read-only.

Prepared Statements #3

Description

@jerustes
try(PreparedStatement st = connection.prepareStatement("SELECT ... ? ... ?"));
    st.setInt(1, anho);
    st.setString(2, nombre);
    ResultSet rs = st.executeQuery(); 
//WARNING: nothing as param to executeQuery or we vulnerable af

Los interrogantes del prepared statement van sin entrecomillar, lo metemos directamente en la cadena, sin concatenar nada. Java ya interpreta directamente cómo tiene que gestionar eso.
Si metiésemos parámetro executeQuery() estaríamos llamando al método de la superclase Statement y seríamos igualmente vulnerables que si no usásemos prepared

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions