BP_PRINT_ERROR(cmd->id, *errorcode);
return -1;
}
- if (blob_length > 0) {
+ if (blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
blob_data =
(unsigned char *)calloc(blob_length, sizeof(unsigned char));
if (blob_data == NULL) {
{
int length = 0;
if ((bp_ipc_read_custom_type(sock, &length,
- sizeof(int)) == 0) && (length > 0)) {
+ sizeof(int)) == 0) && (length > 0) &&(length < BP_MAX_INT_COUNT)) {
int trans_way = 0; // 0:socket 1:shm
if (bp_ipc_read_custom_type(sock, &trans_way,
return -1;
}
- if (blob_length > 0) {
-
+ if (blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
// read here what IPC should be used below from provider.
int trans_way = 0; // 0:socket 1:shm
trans_way = bp_adaptor_ipc_read_int(sock);
*value = shm->mem;
}
}
-
- if ((blob_width = bp_adaptor_ipc_read_int(sock)) < 0 ||
- (blob_height = bp_adaptor_ipc_read_int(sock)) < 0) {
- *errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR);
- BP_PRINT_ERROR(cmd->id, *errorcode);
- return -1;
+ blob_width = bp_adaptor_ipc_read_int(sock);
+ blob_height = bp_adaptor_ipc_read_int(sock);
+ if (blob_width < 0 || blob_width > BP_MAX_INT_COUNT
+ || blob_height < 0 || blob_height > BP_MAX_INT_COUNT ) {
+ *errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR);
+ BP_PRINT_ERROR(cmd->id, *errorcode);
+ return -1;
}
*length = blob_length;
*width = blob_width;
} while(0)
#define BP_MAX_IDS_COUNT 512
+#define BP_MAX_INT_COUNT 2147483646
#define BP_CHECK_IPC_SOCK (g_adaptorinfo == NULL ? -1 : g_adaptorinfo->cmd_socket)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/history-adaptor/include
${CMAKE_SOURCE_DIR}/tab-adaptor/include
+ ${CMAKE_SOURCE_DIR}/common-adaptor/include
${CMAKE_SOURCE_DIR}/bookmark-adaptor/include)
set(BP_LINK_LIBRARIES ${GLIB-2_LIBRARIES}
#include "browser-provider-requests.h"
#include "bookmark-adaptor.h"
+#include "common-adaptor.h"
static sqlite3 *g_db_handle = 0;
static sqlite3_stmt *g_db_basic_get_info_stmt = NULL;
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if (timestamp_count > 0) {
+ if (timestamp_count < BP_MAX_INT_COUNT && timestamp_count > 0) {
bp_bookmark_timestamp_fmt t_timestamps[timestamp_count];
int i = 0;
for (; i < timestamp_count; i++) {
#include "browser-provider-requests.h"
#include "history-adaptor.h"
+#include "common-adaptor.h"
static sqlite3 *g_db_handle = 0;
static sqlite3_stmt *g_db_basic_get_info_stmt = NULL;
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if (timestamp_count > 0) {
+ if (timestamp_count < BP_MAX_INT_COUNT && timestamp_count > 0) {
bp_history_timestamp_fmt t_timestamps[timestamp_count];
int i = 0;
for (; i < timestamp_count; i++) {
#include "browser-provider-db.h"
#include "browser-provider-requests.h"
#include "browser-provider-shm.h"
+#include "common-adaptor.h"
#define BP_PREFIX_URL_PROTOCOL "http\%://"
#define BP_PREFIX_URL_WWW "http\%://www.\%"
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if (blob_length > 0) {
+ if (blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
blob_data =
(unsigned char *)calloc(blob_length, sizeof(unsigned char));
if (blob_data == NULL) {
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if (blob_length > 0) {
+ if (blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
if (bp_ipc_read_custom_type(sock, &width, sizeof(int)) < 0) {
TRACE_ERROR("[ERROR][%d] SET_BLOB [IO_ERROR]", id);
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
bp_ipc_send_errorcode(sock, BP_ERROR_IO_ERROR);
return BP_ERROR_IO_ERROR;
}
- if (blob_length > 0) {
-
+ if ( blob_length < BP_MAX_INT_COUNT && blob_length > 0) {
unsigned char *blob_buffer = NULL;
unsigned char *blob_data = NULL;
// read here what IPC should be used below from provider.