• Lovable Sidekick@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    2 hours ago

    You wouldn’t - what they’re describing is called “SQL injection” - a way to fool poorly written web server code (regardless of what language it’s writen in) into executing SQL code. The poorly written server code takes what’s entered in a form field on a web page and pastes it into a skeleton of a SQL statement - in this case the text in the input field is SQL that ends the intended statement, followed by a new statement that deletes a table. For this to even work, the SQL skeleton on the server would have to be structured in just the right way so the modified version with the pasted-in text still makes sense. For this reason, hackers attempting SQL injection usually have to do a lot of trial and error to get something to happen. The only way it can work at all is if the server software handling the web page sends SQL commands to a database server as text, as if they’re being typed in, and the server executes them. You can’t inject C in this way because unlike SQL, C code isn’t just executed, C programs have to be precompiled.