Skip to content
Snippets Groups Projects
Commit cf4dd48a authored by rswindell's avatar rswindell
Browse files

Address a couple Coverity-scan reported issues: fread() return value checks

parent baf152a3
No related branches found
No related tags found
No related merge requests found
...@@ -124,11 +124,13 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode) ...@@ -124,11 +124,13 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
} }
fseek(smb->sdt_fp,msg->hdr.offset+msg->dfield[i].offset fseek(smb->sdt_fp,msg->hdr.offset+msg->dfield[i].offset
,SEEK_SET); ,SEEK_SET);
fread(&xlat,sizeof(xlat),1,smb->sdt_fp); if(fread(&xlat, 1, sizeof(xlat), smb->sdt_fp) != sizeof(xlat))
continue;
lzh=0; lzh=0;
if(xlat==XLAT_LZH) { if(xlat==XLAT_LZH) {
lzh=1; lzh=1;
fread(&xlat,sizeof(xlat),1,smb->sdt_fp); if(fread(&xlat, 1, sizeof(xlat), smb->sdt_fp) != sizeof(xlat))
continue;
} }
if(xlat!=XLAT_NONE) /* no other translations currently supported */ if(xlat!=XLAT_NONE) /* no other translations currently supported */
continue; continue;
...@@ -145,7 +147,14 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode) ...@@ -145,7 +147,14 @@ char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode)
free(buf); free(buf);
return(NULL); return(NULL);
} }
smb_fread(smb,lzhbuf,length,smb->sdt_fp); if(smb_fread(smb,lzhbuf,length,smb->sdt_fp) != length) {
sprintf(smb->last_error
,"%s read failure of %ld bytes for LZH data"
, __FUNCTION__, length);
free(lzhbuf);
free(buf);
return(NULL);
}
lzhlen=*(int32_t*)lzhbuf; lzhlen=*(int32_t*)lzhbuf;
if((p=(char*)realloc(buf,l+lzhlen+3L))==NULL) { if((p=(char*)realloc(buf,l+lzhlen+3L))==NULL) {
sprintf(smb->last_error sprintf(smb->last_error
......
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