bug fixed: must check store_path_index

pull/48/head^2
yuqing 2015-08-17 14:19:48 +08:00
parent c25d3a7d01
commit d1ba6c61db
3 changed files with 31 additions and 3 deletions

View File

@ -1,11 +1,12 @@
Version 5.07 2015-08-16
Version 5.07 2015-08-17
* schedule task add the "second" field
* make.sh changed, you must upgrade libfastcommon to V1.20 or later
* bug fixed: storage_disk_recovery.c skip the first file (binlog first line)
* bug fixed: should close connection after fetch binlog
* fdfs_storaged.c: advance the position of daemon_init
* set log rotate time format
* bug fixed: must check store_path_index
Version 5.06 2015-05-12
* compile passed in mac OS Darwin

View File

@ -3758,6 +3758,15 @@ static int storage_server_trunk_alloc_space(struct fast_task_info *pTask)
}
trunkInfo.path.store_path_index = *(in_buff+FDFS_GROUP_NAME_MAX_LEN+4);
if (trunkInfo.path.store_path_index < 0 ||
trunkInfo.path.store_path_index >= g_fdfs_store_paths.count)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, store_path_index: %d " \
"is invalid", __LINE__, \
pTask->client_ip, trunkInfo.path.store_path_index);
return EINVAL;
}
if ((result=trunk_alloc_space(file_size, &trunkInfo)) != 0)
{
return result;
@ -3981,6 +3990,16 @@ static int storage_server_trunk_confirm_or_free(struct fast_task_info *pTask)
trunkInfo.file.offset = buff2int(pTrunkBuff->offset);
trunkInfo.file.size = buff2int(pTrunkBuff->size);
if (trunkInfo.path.store_path_index < 0 ||
trunkInfo.path.store_path_index >= g_fdfs_store_paths.count)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, store_path_index: %d " \
"is invalid", __LINE__, \
pTask->client_ip, trunkInfo.path.store_path_index);
return EINVAL;
}
if (pHeader->cmd == STORAGE_PROTO_CMD_TRUNK_ALLOC_CONFIRM)
{
return trunk_alloc_confirm(&trunkInfo, pHeader->status);

View File

@ -750,6 +750,15 @@ static int storage_trunk_restore(const int64_t restore_offset)
break;
}
if (record.trunk.path.store_path_index < 0 ||
record.trunk.path.store_path_index >= g_fdfs_store_paths.count)
{
logError("file: "__FILE__", line: %d, " \
"store_path_index: %d is invalid", __LINE__, \
record.trunk.path.store_path_index);
return EINVAL;
}
line_count++;
if (record.op_type == TRUNK_OP_TYPE_ADD_SPACE)
{
@ -784,8 +793,7 @@ static int storage_trunk_restore(const int64_t restore_offset)
logError("file: "__FILE__", line: %d, "\
"avl_tree_insert fail, " \
"errno: %d, error info: %s", \
__LINE__, result, \
STRERROR(result));
__LINE__, result, STRERROR(result));
return result;
}
else if (result == 0)