fix: Seg_exist function crashes when the second parameter is 0
Co-authored-by: liuchenghao
This commit is contained in:
parent
31617b146c
commit
60b885181a
|
@ -983,7 +983,7 @@ long Cache_read(Cache *cf, char * const output_buf, const off_t len,
|
||||||
off_t dl_offset = (offset_start + len) / cf->blksz * cf->blksz;
|
off_t dl_offset = (offset_start + len) / cf->blksz * cf->blksz;
|
||||||
|
|
||||||
/* ------------------ Check if the segment already exists ---------------*/
|
/* ------------------ Check if the segment already exists ---------------*/
|
||||||
if (Seg_exist(cf, dl_offset)) {
|
if (dl_offset == 0 || Seg_exist(cf, dl_offset)) {
|
||||||
send = Data_read(cf, (uint8_t *) output_buf, len, offset_start);
|
send = Data_read(cf, (uint8_t *) output_buf, len, offset_start);
|
||||||
goto bgdl;
|
goto bgdl;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue