Kaydet (Commit) d93c204f authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1158180 Argument cannot be negative

Change-Id: Ic8dd6aeff02b08c8a3951ce0378eab95ba0c6f1d
üst cbff9d45
......@@ -347,6 +347,7 @@ inline ds_status readProFile(const char* fileName, char** content, size_t* conte
FILE* input = NULL;
size_t size = 0;
char* binary = NULL;
long pos = -1;
*contentSize = 0;
*content = NULL;
......@@ -358,7 +359,14 @@ inline ds_status readProFile(const char* fileName, char** content, size_t* conte
}
fseek(input, 0L, SEEK_END);
size = ftell(input);
pos = ftell(input);
if (pos < 0)
{
fclose(input);
return DS_FILE_ERROR;
}
size = pos;
rewind(input);
binary = (char*)malloc(size);
if (binary == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment