// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if(ids_count >= 256 || ids_count <= 0) {
+ if(ids_count >= BP_MAX_IDS_COUNT || ids_count <= 0) {
pthread_mutex_unlock(&g_adaptor_mutex);
return -1;
} else {
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
TRACE_ERROR("[CRITICAL] allocation");
return -1;
}
*ids = idlist;
+ return ids_count;
}
- return ids_count;
+ else if (ids_count >= BP_MAX_IDS_COUNT) {
+ TRACE_DEBUG("Count exceeded [%d]", ids_count);
+ return -1;
+ }
}
int bp_common_adaptor_get_string(const int sock, bp_command_fmt *cmd,
}\
} while(0)
+#define BP_MAX_IDS_COUNT 512
+
#define BP_CHECK_IPC_SOCK (g_adaptorinfo == NULL ? -1 : g_adaptorinfo->cmd_socket)
#define BP_PRINT_ERROR(id, errorcode) bp_common_print_errorcode(__FUNCTION__, __LINE__, id, errorcode)
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_ERROR("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;
// int count.
int ids_count = bp_adaptor_ipc_read_int(sock);
TRACE_DEBUG("response ids count:%d", ids_count);
- if (ids_count < 256 && ids_count > 0) {
+ if (ids_count < BP_MAX_IDS_COUNT&& ids_count > 0) {
int *idlist = (int *)calloc(ids_count, sizeof(int));
if (idlist == NULL) {
errorcode = BP_ERROR_OUT_OF_MEMORY;