Skip to content

Commit

Permalink
DVBCam: Fix coverity 700258. Unchecked return value of ioctl. If the …
Browse files Browse the repository at this point in the history
…ioctl fails then numslots is going to be populated with a random value, as the caps struct will be uninitialised.
  • Loading branch information
stuartm committed Jun 15, 2013
1 parent 2b074dd commit a1955f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mythtv/libs/libmythtv/recorders/dvbcam.cpp
Expand Up @@ -72,8 +72,12 @@ DVBCam::DVBCam(const QString &aDevice)
if (cafd >= 0)
{
ca_caps_t caps;
ioctl(cafd, CA_GET_CAP, &caps);
numslots = caps.slot_num;
// slot_num will be uninitialised if ioctl fails
if (ioctl(cafd, CA_GET_CAP, &caps) >= 0)
numslots = caps.slot_num;
else
LOG(VB_GENERAL, LOG_ERR, "ioctl CA_GET_CAP failed");

close(cafd);
}
}
Expand Down

0 comments on commit a1955f6

Please sign in to comment.