File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,12 @@ safe:
287287 }
288288
289289 plc->quoted = stmt->dbh ->methods ->quoter (stmt->dbh , buf, param_type);
290+ if (plc->quoted == NULL ) {
291+ /* bork */
292+ ret = -1 ;
293+ strncpy (stmt->error_code , stmt->dbh ->error_code , 6 );
294+ goto clean_up;
295+ }
290296 }
291297 }
292298
Original file line number Diff line number Diff line change 1+ --TEST--
2+ #GHSA-8xr5-qppj-gvwj: NULL Pointer Derefernce for failed user input quoting
3+ --EXTENSIONS--
4+ pdo
5+ pdo_pgsql
6+ --SKIPIF--
7+ <?php
8+ require_once dirname (__FILE__ ) . '/../../../ext/pdo/tests/pdo_test.inc ' ;
9+ require_once dirname (__FILE__ ) . '/config.inc ' ;
10+ PDOTest::skip ();
11+ ?>
12+ --FILE--
13+ <?php
14+ require_once dirname (__FILE__ ) . '/../../../ext/pdo/tests/pdo_test.inc ' ;
15+ require_once dirname (__FILE__ ) . '/config.inc ' ;
16+ $ db = PDOTest::test_factory (dirname (__FILE__ ) . '/common.phpt ' );
17+ $ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
18+ $ db ->setAttribute (PDO ::ATTR_EMULATE_PREPARES , true );
19+
20+ $ sql = "SELECT * FROM users where username = :username " ;
21+ $ stmt = $ db ->prepare ($ sql );
22+
23+ $ p1 = "alice \x99" ;
24+ var_dump ($ stmt ->execute (['username ' => $ p1 ]));
25+
26+ ?>
27+ --EXPECT--
28+ bool(false)
You can’t perform that action at this time.
0 commit comments