Skip to content

Commit

Permalink
ignore range->end >= file_size
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqing committed Mar 14, 2017
1 parent be5fb92 commit d2b9958
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion HISTORY
@@ -1,6 +1,7 @@

Version 1.19 2017-01-10
Version 1.19 2017-03-14
* change INT64_PRINTF_FORMAT to PRId64
* ignore range->end >= file_size

Version 1.18 2016-02-24
* bug fixed: do NOT use header_only field of request,
Expand Down
10 changes: 5 additions & 5 deletions src/common.c
Expand Up @@ -467,10 +467,10 @@ static int fdfs_check_and_format_range(struct fdfs_http_range *range,
start = range->start + file_size;
if (start < 0)
{
logError("file: "__FILE__", line: %d, " \
"invalid range value: %"PRId64, \
logWarning("file: "__FILE__", line: %d, " \
"invalid range value: %"PRId64", set to 0", \
__LINE__, range->start);
return EINVAL;
start = 0;
}
range->start = start;
}
Expand All @@ -489,11 +489,11 @@ static int fdfs_check_and_format_range(struct fdfs_http_range *range,
}
else if (range->end >= file_size)
{
logError("file: "__FILE__", line: %d, " \
logWarning("file: "__FILE__", line: %d, " \
"invalid range end value: %"PRId64 \
", exceeds file size: %"PRId64, \
__LINE__, range->end, file_size);
return EINVAL;
range->end = file_size - 1;
}

if (range->start > range->end)
Expand Down

0 comments on commit d2b9958

Please sign in to comment.