From 29c090934b44d6b1a8c3bb355258777b44c9a1d2 Mon Sep 17 00:00:00 2001 From: "Frank M. Kromann" Date: Wed, 17 Oct 2001 18:36:32 +0000 Subject: [PATCH] Return a warning when fbsql_read_blob or fbsql_read_clob is called with an invalid handle --- ext/fbsql/php_fbsql.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.50.1