]> granicus.if.org Git - php/commitdiff
Prevent possible crash when working with column containing NULL.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 19 May 2004 20:34:01 +0000 (20:34 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 19 May 2004 20:34:01 +0000 (20:34 +0000)
ext/pdo_mysql/mysql_statement.c

index 6f8d70a06ad793758992bb8d87346d3b8fa8c73d..f8e1b3d097ea211aa88eeaa94e36c424b196355d 100755 (executable)
@@ -139,7 +139,9 @@ static int mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned
                pdo_mysql_error(S->H);
                return 0;
        }
-       *ptr = estrndup(S->current_data[colno], S->current_lengths[colno] +1);
+       if (S->current_data[colno]) {
+               *ptr = estrndup(S->current_data[colno], S->current_lengths[colno] +1);
+       }
        *len = S->current_lengths[colno];
        return 1;
 }