bin/xbps-checkvers/main.c: CID 62705 (argument cannot be negative)
This commit is contained in:
parent
1a19adf85c
commit
8c5ef42935
@ -245,6 +245,7 @@ static bool
|
||||
rcv_load_file(rcv_t *rcv, const char *fname)
|
||||
{
|
||||
FILE *file;
|
||||
long offset;
|
||||
rcv->fname = fname;
|
||||
|
||||
if ((file = fopen(rcv->fname, "r")) == NULL) {
|
||||
@ -256,9 +257,15 @@ rcv_load_file(rcv_t *rcv, const char *fname)
|
||||
}
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
rcv->len = (size_t)ftell(file);
|
||||
offset = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
if (offset == -1) {
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
rcv->len = (size_t)offset;
|
||||
|
||||
if (rcv->input != NULL)
|
||||
free(rcv->input);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user