diff --git a/lib/decinfo.c b/lib/decinfo.c index 0d5c8d21dcb1f5888334dd3168cac45e704003f6..4e21e64838408bfd05951fe10b7b38a6211c162f 100644 --- a/lib/decinfo.c +++ b/lib/decinfo.c @@ -174,7 +174,14 @@ static int oc_dec_headerin(oc_pack_buf *_opb,th_info *_info, packtype=(int)val; /*If we're at a data packet and we have received all three headers, we're done.*/ - if(!(packtype&0x80)&&_info->frame_width>0&&_tc->vendor!=NULL&&*_setup!=NULL){ + if(!(packtype&0x80)&&_info->frame_width>0){ + /*Our documentation says we'll return TH_EFAULT if these are NULL, so let's + check.*/ + if(_tc==NULL||_setup==NULL)return TH_EFAULT; + /*Otherwise, if we didn't get all of the headers, this was not the next + packet in the expected sequence.*/ + else if(_tc->vendor==NULL||*_setup==NULL)return TH_EBADHEADER; + /*Otherwise, we're done.*/ return 0; } /*Check the codec string.*/