timeshift: fix some coverity issues
This commit is contained in:
parent
d3fcdf37a7
commit
ab8f4bf1f4
1 changed files with 8 additions and 3 deletions
|
@ -52,8 +52,8 @@ static ssize_t _read_pktbuf ( int fd, pktbuf_t **pktbuf )
|
|||
if (r != sizeof(sz)) return 0;
|
||||
cnt += r;
|
||||
|
||||
/* Empty */
|
||||
if (!sz) {
|
||||
/* Empty And Sanity Check */
|
||||
if (!sz || sz > 1024 * 1024) {
|
||||
*pktbuf = NULL;
|
||||
return cnt;
|
||||
}
|
||||
|
@ -93,6 +93,9 @@ static ssize_t _read_msg ( int fd, streaming_message_t **sm )
|
|||
/* EOF */
|
||||
if (sz == 0) return cnt;
|
||||
|
||||
/* Wrong data size */
|
||||
if (sz > 1024 * 1024) return -1;
|
||||
|
||||
/* Type */
|
||||
r = read(fd, &type, sizeof(type));
|
||||
if (r < 0) return -1;
|
||||
|
@ -320,10 +323,12 @@ static int _timeshift_read
|
|||
if (*cur_file) {
|
||||
|
||||
/* Open file */
|
||||
if (*fd == -1) {
|
||||
if (*fd < 0) {
|
||||
tvhtrace("timeshift", "ts %d open file %s",
|
||||
ts->id, (*cur_file)->path);
|
||||
*fd = open((*cur_file)->path, O_RDONLY);
|
||||
if (*fd < 0)
|
||||
return -1;
|
||||
}
|
||||
tvhtrace("timeshift", "ts %d seek to %jd", ts->id, (intmax_t)*cur_off);
|
||||
lseek(*fd, *cur_off, SEEK_SET);
|
||||
|
|
Loading…
Add table
Reference in a new issue