From: Frank M. Kromann Date: Wed, 17 Oct 2001 18:36:32 +0000 (+0000) Subject: Return a warning when fbsql_read_blob or fbsql_read_clob is called with an invalid... X-Git-Tag: POST_PARAMETER_PARSING_API~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29c090934b44d6b1a8c3bb355258777b44c9a1d2;p=php Return a warning when fbsql_read_blob or fbsql_read_clob is called with an invalid handle --- diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index e4ac0ca3c2..73f296c2d4 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -1031,8 +1031,13 @@ static void php_fbsql_read_lob(INTERNAL_FUNCTION_PARAMETERS, int lob_type) ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink); convert_to_string_ex(lob_handle); - length = fbcbhBlobSize((FBCBlobHandle *)Z_STRVAL_PP(lob_handle)); + if (Z_STRLEN_PP(lob_handle) != 27 || Z_STRVAL_PP(lob_handle)[0] != '@') { + if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, "The handle is invalid"); + RETURN_FALSE; + } + + length = fbcbhBlobSize((FBCBlobHandle *)Z_STRVAL_PP(lob_handle)); if (lob_type == 0) value = estrndup((char *)fbcdcReadBLOB(phpLink->connection, (FBCBlobHandle *)Z_STRVAL_PP(lob_handle)), length); else