]> granicus.if.org Git - php/commitdiff
MFH. Protect against underflow - refs http://pecl.php.net/bugs/bug.php?id=5193
authorGeorge Schlossnagle <gschlossnagle@php.net>
Thu, 1 Sep 2005 14:44:11 +0000 (14:44 +0000)
committerGeorge Schlossnagle <gschlossnagle@php.net>
Thu, 1 Sep 2005 14:44:11 +0000 (14:44 +0000)
ext/pdo/pdo_stmt.c

index b988598e664cf60018ce5fd76d308098d5ed7567..1dd5c79a0f65500e1f39e0d39b5b0f4dae20b925 100755 (executable)
@@ -1541,7 +1541,10 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
        if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colno)) {
                RETURN_FALSE;
        }
-
+       if(colno < 0) {
+               pdo_raise_impl_error(stmt->dbh, stmt, "42P10", "column number must be non-negative" TSRMLS_CC);
+               RETURN_FALSE;
+       }
        if (!stmt->methods->get_column_meta) {
                pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver doesn't support meta data" TSRMLS_CC);
                RETURN_FALSE;