Skip to content
Snippets Groups Projects
Commit 2cf718ce authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Print error and return NULL from getfmsg() upon ftell error

Caught by Coverity - ftell[o] can return negative.
parent fd49da28
No related branches found
No related tags found
No related merge requests found
......@@ -3224,6 +3224,10 @@ char* getfmsg(FILE* stream, ulong* outlen)
length=0L;
start=ftello(stream); /* Beginning of Message */
if(start < 0) {
lprintf(LOG_ERR, "ERROR %d line %d getting file offset", errno, __LINE__);
return NULL;
}
while(1) {
ch=fgetc(stream); /* Look for Terminating NULL */
if(ch==0 || ch==EOF) /* Found end of message */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment