SQLite
Check-in [ac760db0]
Not logged in
Overview
SHA1:ac760db0727209db0a816e112ea5f47e54d54dac
Date: 2017-03-01 11:30:27
User: dan
Comment:Fix a use-after-free problem in the shell tool code that could occur if an SQL statement were executed after an ".open" command with invalid options.
Tags And Properties
Context
2017-03-02
13:13
[29f54b89] Make sure the Vdbe.expmask value is set correctly in sqlite3VdbeSwap(). This fixes a problem introduced by [a8fd7052]. (user: drh, tags: trunk)
2017-03-01
11:30
[ac760db0] Fix a use-after-free problem in the shell tool code that could occur if an SQL statement were executed after an ".open" command with invalid options. (user: dan, tags: trunk)
2017-02-27
17:16
[23a8917e] Make PATH handling more robust in the batch tools for MSVC. (user: mistachkin, tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

4340
4341
4342
4343
4344
4345
4346

4347
4348
4349
4350
4351
4352
4353
    char *zNewFilename;  /* Name of the database file to open */
    int iName = 1;       /* Index in azArg[] of the filename */
    int newFlag = 0;     /* True to delete file before opening */
    /* Close the existing database */
    session_close_all(p);
    sqlite3_close(p->db);
    p->db = 0;

    sqlite3_free(p->zFreeOnClose);
    p->zFreeOnClose = 0;
    /* Check for command-line arguments */
    for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
      const char *z = azArg[iName];
      if( optionMatch(z,"new") ){
        newFlag = 1;







>







4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
    char *zNewFilename;  /* Name of the database file to open */
    int iName = 1;       /* Index in azArg[] of the filename */
    int newFlag = 0;     /* True to delete file before opening */
    /* Close the existing database */
    session_close_all(p);
    sqlite3_close(p->db);
    p->db = 0;
    p->zDbFilename = 0;
    sqlite3_free(p->zFreeOnClose);
    p->zFreeOnClose = 0;
    /* Check for command-line arguments */
    for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
      const char *z = azArg[iName];
      if( optionMatch(z,"new") ){
        newFlag = 1;